diff options
author | Bert <ber.t@gmx.com> | 2011-04-05 00:37:37 +0200 |
---|---|---|
committer | Bert <ber.t@gmx.com> | 2011-04-05 00:37:37 +0200 |
commit | 426edfb3498469b171aae6a582491c2c7e30fd51 (patch) | |
tree | 96fd579d07b0fc8fcd384f8cc35b4097d6930934 /main.c | |
parent | 8d4e3a57ab93429ca8c3e8e9b1cb1ce21ee4b609 (diff) | |
download | nsxiv-426edfb3498469b171aae6a582491c2c7e30fd51.tar.zst |
Readded file-type check at startup
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -178,7 +178,7 @@ void update_title() { fileidx + 1, filecnt, (int) (img.zoom * 100.0), size, unit, filenames[fileidx]); } else { - n = snprintf(win_title, TITLE_LEN, "sxiv: [%d/%d] not an image: %s", + n = snprintf(win_title, TITLE_LEN, "sxiv: [%d/%d] invalid: %s", fileidx + 1, filecnt, filenames[fileidx]); } } @@ -193,7 +193,13 @@ void update_title() { } int check_append(const char *filename) { - if (filename && !access(filename, R_OK)) { + if (!filename) + return 0; + + if (access(filename, R_OK)) { + warn("could not open file: %s", filename); + return 0; + } else if (img_check(filename)) { if (fileidx == filecnt) { filecnt *= 2; filenames = (const char**) s_realloc(filenames, @@ -202,7 +208,6 @@ int check_append(const char *filename) { filenames[fileidx++] = filename; return 1; } else { - warn("could not open file: %s", filename); return 0; } } |