summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2012-01-26 22:46:15 +0100
committerDaniel Friesel <derf@finalrewind.org>2012-01-26 22:46:15 +0100
commita0b8bcccb0daeec085eb612abb87834795af01d8 (patch)
treeaf464d3143a4973f49bb3e9f0a0a9a844f8c85d5 /src
parenta6be2495675771256570a75841815d4e3de80934 (diff)
feh --filelist: Do not overwrite filelist file if it is an image
Diffstat (limited to 'src')
-rw-r--r--src/filelist.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/filelist.c b/src/filelist.c
index 6439b9d..94baa06 100644
--- a/src/filelist.c
+++ b/src/filelist.c
@@ -460,10 +460,23 @@ gib_list *feh_read_filelist(char *filename)
FILE *fp;
gib_list *list = NULL;
char s[1024], s1[1024];
+ Imlib_Image tmp_im;
+ struct stat st;
if (!filename)
return(NULL);
+ /*
+ * feh_load_image will fail horribly if filename is not seekable
+ */
+ if (!stat(filename, &st) && S_ISREG(st.st_mode) &&
+ feh_load_image_char(&tmp_im, filename)) {
+ weprintf("Filelist file %s is an image, refusing to use it.\n"
+ "Did you mix up -f and -F?", filename);
+ opt.filelistfile = NULL;
+ return NULL;
+ }
+
errno = 0;
if ((fp = fopen(filename, "r")) == NULL) {
/* return quietly, as it's okay to specify a filelist file that doesn't