Commit a0b8bccc authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

feh --filelist: Do not overwrite filelist file if it is an image

parent a6be2495
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -7,6 +7,9 @@ git HEAD
      <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=655431>
    * Do not refer to --help unless help is compiled in
      <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=657171>
    * Do not overwrite filelist file if it actually is an image
      (-f and -F may get mixed up)
      <https://github.com/derf/feh/issues/79>

Mon, 02 Jan 2012 11:54:01 +0100  Daniel Friesel <derf@finalrewind.org>

+13 −0
Original line number Diff line number Diff line
@@ -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