Index: src/files.c =================================================================== --- src/files.c (revision 5276) +++ src/files.c (working copy) @@ -339,6 +339,28 @@ } #endif + /* When the given filename is not empty, verify that it exists + * and is a normal file. */ + if (strcmp(filename, "") != 0) { + struct stat fileinfo; + + rc = stat(filename, &fileinfo); + + if (rc == 0 && !S_ISREG(fileinfo.st_mode)) { + statusbar(_("\"%s\" is not a normal file"), filename); + beep(); + return; + } + + /* When the file does not exist, only fail when doing ^R, + * not when specifying a new file on the command line. */ + if (rc == -1 && undoable) { + statusbar(_("\"%s\" not found"), filename); + beep(); + return; + } + } + /* If we're loading into a new buffer, add a new entry to * openfile. */ if (new_buffer) {