From 011759bc3d986f34f4b05154de4a701f25d67a8a Mon Sep 17 00:00:00 2001 From: dcoppa Date: Tue, 15 Apr 2014 13:02:21 +0000 Subject: [PATCH] A couple of bugfixes from upstream: Fix for segfault due to erroneous free() in case of scandir failed to scan directory (git commit 5f210b5b2b0b150acf8f4b5890c9811cd65e2aa9) re-randomize after list is through (upstream git commit a0ddc0dcff5d43871f8c0e87dfb5d2c49671ac30) --- graphics/feh/Makefile | 3 +- graphics/feh/patches/patch-src_filelist_c | 55 ++++++++++++++++++++++ graphics/feh/patches/patch-src_slideshow_c | 25 ++++++++++ 3 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 graphics/feh/patches/patch-src_filelist_c create mode 100644 graphics/feh/patches/patch-src_slideshow_c diff --git a/graphics/feh/Makefile b/graphics/feh/Makefile index 2fee8e9039b..01f13812622 100644 --- a/graphics/feh/Makefile +++ b/graphics/feh/Makefile @@ -1,8 +1,9 @@ -# $OpenBSD: Makefile,v 1.58 2014/03/12 11:41:43 dcoppa Exp $ +# $OpenBSD: Makefile,v 1.59 2014/04/15 13:02:21 dcoppa Exp $ COMMENT= lightweight image viewer DISTNAME= feh-2.10 +REVISION= 0 EXTRACT_SUFX= .tar.bz2 CATEGORIES= graphics diff --git a/graphics/feh/patches/patch-src_filelist_c b/graphics/feh/patches/patch-src_filelist_c new file mode 100644 index 00000000000..6d36a89f542 --- /dev/null +++ b/graphics/feh/patches/patch-src_filelist_c @@ -0,0 +1,55 @@ +$OpenBSD: patch-src_filelist_c,v 1.3 2014/04/15 13:02:21 dcoppa Exp $ + +commit 5f210b5b2b0b150acf8f4b5890c9811cd65e2aa9 +Author: Michael Vorburger +Date: Sun Dec 29 22:34:11 2013 +0100 + +Fix for segfault due to erroneous free() in case of scandir failed +to scan directory + +--- src/filelist.c.orig Fri Feb 28 18:23:20 2014 ++++ src/filelist.c Tue Apr 15 14:40:39 2014 +@@ -263,27 +263,27 @@ void add_file_to_filelist_recursively(char *origpath, + default: + weprintf("Failed to scan directory %s:", path); + } +- } ++ } else { ++ for (cnt = 0; cnt < n; cnt++) { ++ if (strcmp(de[cnt]->d_name, ".") ++ && strcmp(de[cnt]->d_name, "..")) { ++ char *newfile; + +- for (cnt = 0; cnt < n; cnt++) { +- if (strcmp(de[cnt]->d_name, ".") +- && strcmp(de[cnt]->d_name, "..")) { +- char *newfile; ++ newfile = estrjoin("", path, "/", de[cnt]->d_name, NULL); + +- newfile = estrjoin("", path, "/", de[cnt]->d_name, NULL); ++ /* This ensures we go down one level even if not fully recursive ++ - this way "feh some_dir" expands to some_dir's contents */ ++ if (opt.recursive) ++ add_file_to_filelist_recursively(newfile, FILELIST_CONTINUE); ++ else ++ add_file_to_filelist_recursively(newfile, FILELIST_LAST); + +- /* This ensures we go down one level even if not fully recursive +- - this way "feh some_dir" expands to some_dir's contents */ +- if (opt.recursive) +- add_file_to_filelist_recursively(newfile, FILELIST_CONTINUE); +- else +- add_file_to_filelist_recursively(newfile, FILELIST_LAST); +- +- free(newfile); ++ free(newfile); ++ } ++ free(de[cnt]); + } +- free(de[cnt]); ++ free(de); + } +- free(de); + closedir(dir); + } else if (S_ISREG(st.st_mode)) { + D(("Adding regular file %s to filelist\n", path)); diff --git a/graphics/feh/patches/patch-src_slideshow_c b/graphics/feh/patches/patch-src_slideshow_c new file mode 100644 index 00000000000..fc21997b4fd --- /dev/null +++ b/graphics/feh/patches/patch-src_slideshow_c @@ -0,0 +1,25 @@ +$OpenBSD: patch-src_slideshow_c,v 1.9 2014/04/15 13:02:21 dcoppa Exp $ + +commit a0ddc0dcff5d43871f8c0e87dfb5d2c49671ac30 +Author: Roland Angerer +Date: Thu Apr 10 10:32:07 2014 +0200 + +re-randomize after list is through + +--- src/slideshow.c.orig Fri Feb 28 18:23:21 2014 ++++ src/slideshow.c Tue Apr 15 14:45:03 2014 +@@ -692,7 +692,13 @@ gib_list *feh_list_jump(gib_list * root, gib_list * l, + if (opt.cycle_once) { + exit(0); + } +- ret = root; ++ if (opt.randomize) { ++ /* Randomize the filename order */ ++ filelist = gib_list_randomize(filelist); ++ ret = filelist; ++ } else { ++ ret = root; ++ } + } + } else { + if (ret->prev)