Change an eprintf to a die to stop child from running its own slideshow
authorDavid Phillips <dbphillipsnz@gmail.com>
Thu, 10 Dec 2015 23:23:45 +0000 (12:23 +1300)
committerMarkus Teich <markus.teich@stusta.mhn.de>
Thu, 24 Dec 2015 00:57:50 +0000 (01:57 +0100)
The child thread was created because execlp will not return if successful.
The eprintf was placed after the call to execlp to catch any error, but the
child continued to return a (closed) fds[0], resulting in a second slideshow
being run by the child.

This commit fixes the issue by killing the child.

sent.c

diff --git a/sent.c b/sent.c
index 99361e843cf5ce7ef7240497ebc9a92edfc062f5..cdc637f62f5312b05476683d7e684d664e0255bc 100644 (file)
--- a/sent.c
+++ b/sent.c
@@ -153,7 +153,7 @@ filter(int fd, const char *cmd)
                close(fds[0]);
                close(fds[1]);
                execlp("sh", "sh", "-c", cmd, (char *)0);
-               eprintf("execlp sh -c '%s':", cmd);
+               die("execlp sh -c '%s':", cmd);
        }
        close(fds[1]);
        return fds[0];