commit 2d86c0725718e46bdf246d2434b7f2d123a3faa5
parent 283bf2e17c0ffb78933cc52c502803609dfadda7
Author: FRIGN <dev@frign.de>
Date: Wed, 25 May 2016 16:47:33 +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.
Diffstat:
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/driver/posix/scc.c b/driver/posix/scc.c
@@ -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);
@@ -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);