diff --git a/src/nano.c b/src/nano.c
index 7204b45d3dede22a977e03edd710829be9eea0df..573f8219c8eb21da5507895d52fc193f64b1d619 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -2360,7 +2360,7 @@ int main(int argc, char **argv)
 	alt_speller = NULL;
 #endif
 
-	do_rcfile();
+	do_rcfiles();
 
 #ifdef DEBUG
 	fprintf(stderr, "After rebinding keys...\n");
diff --git a/src/proto.h b/src/proto.h
index 5de93ecbf78d4b264ece12b806eb04a78dc5f794..f3c9b0ee4c83ecb17fb1a5c973d542a01ccabdd1 100644
--- a/src/proto.h
+++ b/src/proto.h
@@ -527,7 +527,7 @@ bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright);
 void grab_and_store(const char *kind, char *ptr, regexlisttype **storage);
 #endif
 void parse_rcfile(FILE *rcstream, bool syntax_only);
-void do_rcfile(void);
+void do_rcfiles(void);
 #endif /* !DISABLE_NANORC */
 
 /* All functions in search.c. */
diff --git a/src/rcfile.c b/src/rcfile.c
index 2cbc452318c84cb41bec37ff1b011ea3bc3fb63e..1ae8863d8efec412f6fa87b9f97a94da4d11a7a8 100644
--- a/src/rcfile.c
+++ b/src/rcfile.c
@@ -1232,25 +1232,36 @@ void parse_rcfile(FILE *rcstream, bool syntax_only)
     return;
 }
 
-/* First read the system-wide rcfile, then the user's rcfile. */
-void do_rcfile(void)
+/* Read and interpret one of the two nanorc files. */
+void parse_one_nanorc(void)
 {
     FILE *rcstream;
 
-    nanorc = mallocstrcpy(nanorc, SYSCONFDIR "/nanorc");
-
-    /* Warn about directories, character files, or block files. */
+    /* Don't try to open directories nor devices. */
     if (!is_good_file(nanorc))
-	;
+	return;
 
 #ifdef DEBUG
-    fprintf(stderr, "Parsing file \"%s\"\n", nanorc);
+    fprintf(stderr, "Going to parse file \"%s\"\n", nanorc);
 #endif
 
-    /* Try to open the system-wide nanorc. */
     rcstream = fopen(nanorc, "rb");
+
+    /* If opening the file succeeded, parse it.  Otherwise, only
+     * complain if the file actually exists. */
     if (rcstream != NULL)
 	parse_rcfile(rcstream, FALSE);
+    else if (errno != ENOENT)
+	rcfile_error(N_("Error reading %s: %s"), nanorc, strerror(errno));
+}
+
+/* First read the system-wide rcfile, then the user's rcfile. */
+void do_rcfiles(void)
+{
+    nanorc = mallocstrcpy(nanorc, SYSCONFDIR "/nanorc");
+
+    /* Process the system-wide nanorc. */
+    parse_one_nanorc();
 
     /* When configured with --disable-wrapping-as-root, turn wrapping off
      * for root, so that only root's .nanorc or --fill can turn it on. */
@@ -1267,25 +1278,13 @@ void do_rcfile(void)
 	nanorc = charealloc(nanorc, strlen(homedir) + strlen(RCFILE_NAME) + 2);
 	sprintf(nanorc, "%s/%s", homedir, RCFILE_NAME);
 
-	/* Warn about directories, character files, or block files. */
-	if (!is_good_file(nanorc))
-	    ;
-
-	/* Try to open the current user's nanorc. */
-	rcstream = fopen(nanorc, "rb");
-	if (rcstream == NULL) {
-	    /* Don't complain about the file's not existing. */
-	    if (errno != ENOENT)
-		rcfile_error(N_("Error reading %s: %s"), nanorc,
-				strerror(errno));
-	} else
-	    parse_rcfile(rcstream, FALSE);
+	/* Process the current user's nanorc. */
+	parse_one_nanorc();
     }
 
     check_vitals_mapped();
 
     free(nanorc);
-    nanorc = NULL;
 
     if (errors && !ISSET(QUIET)) {
 	errors = FALSE;