bim: Report errors when opening files

This commit is contained in:
K. Lange 2021-09-26 15:09:20 +09:00
parent 14ae8e37d8
commit a6f063b06d
2 changed files with 7 additions and 0 deletions

View File

@ -3842,6 +3842,12 @@ void open_file(char * file) {
}
f = fopen(_file, "r");
if (file != _file) free(_file);
if (!f && errno != ENOENT) {
render_error("%s: %s", file, strerror(errno));
pause_for_key();
close_buffer();
return;
}
env->file_name = strdup(file);
}

View File

@ -19,6 +19,7 @@
#include <dirent.h>
#include <poll.h>
#include <limits.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/stat.h>