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)
This commit is contained in:
dcoppa 2014-04-15 13:02:21 +00:00
parent b0322aebe4
commit 011759bc3d
3 changed files with 82 additions and 1 deletions

View File

@ -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

View File

@ -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 <mike@vorburger.ch>
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));

View File

@ -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 <dev@rangerer.at>
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)