[hackers] [sent] _exit() instead of exit() after failed exec || FRIGN

From: <git_AT_suckless.org>
Date: Fri, 12 Aug 2016 10:03:20 +0200 (CEST)

commit e8914d5d4bedb12bccf78a930b34b1564b3dbaac
Author: FRIGN <dev_AT_frign.de>
AuthorDate: Thu Aug 11 21:20:07 2016 +0200
Commit: Markus Teich <markus.teich_AT_stusta.mhn.de>
CommitDate: Thu Aug 11 23:42:09 2016 +0200

    _exit() instead of exit() after failed exec
    
    die() calls exit(), but actually at this point the program could be in a
    state not allowing this. It's better to call _exit to stop the libc from
    calling any handlers that might fail at this moment anyway.

diff --git a/sent.c b/sent.c
index f6c57fb..a4d0cd2 100644
--- a/sent.c
+++ b/sent.c
_AT_@ -150,7 +150,8 @@ filter(int fd, const char *cmd)
                 close(fds[0]);
                 close(fds[1]);
                 execlp("sh", "sh", "-c", cmd, (char *)0);
- die("sent: execlp sh -c '%s':", cmd);
+ fprintf(stderr, "sent: execlp sh -c '%s': %s\n", cmd, strerror(errno));
+ _exit(1);
         }
         close(fds[1]);
         return fds[0];
Received on Fri Aug 12 2016 - 10:03:20 CEST

This archive was generated by hypermail 2.3.0 : Fri Aug 12 2016 - 10:12:14 CEST