[hackers] [scc] [driver] neither call abort(), nor exit(), but _exit() after exec-fail || FRIGN

From: <git_AT_suckless.org>
Date: Wed, 25 May 2016 16:48:43 +0200 (CEST)

commit 2d86c0725718e46bdf246d2434b7f2d123a3faa5
Author: FRIGN <dev_AT_frign.de>
AuthorDate: Wed May 25 16:47:33 2016 +0200
Commit: FRIGN <dev_AT_frign.de>
CommitDate: Wed May 25 16:47:33 2016 +0200

    [driver] neither call abort(), nor exit(), but _exit() after exec-fail
    
    exit() among other things does some cleanup. We cannot guarantee a
    proper application state after a failed exec though, so we have to
    resort to _exit() which does not do any cleanups.

diff --git a/driver/posix/scc.c b/driver/posix/scc.c
index 3c9073a..4dc3775 100644
--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
_AT_@ -48,12 +48,11 @@ cc1(int fd)
                 dup2(fd, 1);
                 fmt = (arch) ? "%s/libexec/scc/cc1-%s" : "%s/libexec/scc/cc1";
                 r = snprintf(cmd, sizeof(cmd), fmt, PREFIX, arch);
- if (r == sizeof(cmd)) {
+ if (r == sizeof(cmd))
                         die("scc: incorrect prefix\n");
- }
                 execv(cmd, argcc1);
- die("scc: execv cc1: %s", strerror(errno));
- abort();
+ fprintf(stderr, "scc: execv cc1: %s\n", strerror(errno));
+ _exit(1);
         default:
                 pid_cc1 = pid;
                 close(fd);
_AT_@ -75,12 +74,11 @@ cc2(int fd)
                 dup2(fd, 0);
                 fmt = (arch) ? "%s/libexec/scc/cc2-%s" : "%s/libexec/scc/cc2";
                 r = snprintf(cmd, sizeof(cmd), fmt, PREFIX, arch);
- if (r == sizeof(cmd)) {
+ if (r == sizeof(cmd))
                         die("scc: incorrect prefix");
- }
                 execv(cmd, argcc2);
                 fprintf(stderr, "scc: execv cc2: %s\n", strerror(errno));
- abort();
+ _exit(1);
         default:
                 pid_cc2 = pid;
                 close(fd);
Received on Wed May 25 2016 - 16:48:43 CEST

This archive was generated by hypermail 2.3.0 : Wed May 25 2016 - 17:00:17 CEST