From 5eb2bf251f7555a3f0365a4fe1a40902e93c9c75 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 24 Jun 2016 00:28:06 +0200 Subject: Also handle fork() failure in magick_load_image --- ChangeLog | 1 + src/imlib.c | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4d4a560..9206640 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ git HEAD * Fix crash when trying to rotate a JPEG image without having jpegtran / jpegexiforient installed + * Handle failing fork() calls gracefully Thu, 09 Jun 2016 08:59:35 +0200 Daniel Friesel diff --git a/src/imlib.c b/src/imlib.c index fb1a589..90188e1 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -312,7 +312,13 @@ static char *feh_magick_load_image(char *filename) snprintf(argv_fd, sizeof(argv_fd), "png:fd:%d", fd); - if ((childpid = fork()) == 0) { + if ((childpid = fork()) < 0) { + weprintf("%s: Can't load with imagemagick. Fork failed:", filename); + unlink(sfn); + free(sfn); + sfn = NULL; + } + else if (childpid == 0) { /* discard convert output */ devnull = open("/dev/null", O_WRONLY); -- cgit v1.2.3