shithub: scc

Download patch

ref: e15b961f04420e53a107bab62c5af4eafd21e752
parent: 677832e25c33b80ab979dcbf7c7e74352e526906
author: FRIGN <[email protected]>
date: Wed May 25 12:47:33 EDT 2016

[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.

--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
@@ -48,12 +48,11 @@
 		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 @@
 		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);