shithub: scc

Download patch

ref: ac2335bcf6ddc65ff3ed64e87b0f3d02a7fad6db
parent: ad3e847a2aeabde0871b6da021276ae903c1faeb
author: Quentin Rameau <quinq@fifth.space>
date: Thu Jun 16 09:12:07 EDT 2016

[driver] and move object cleaning in terminate too

atexit() is run whether there has been an error or we return normally so
it's better to do the cleaning there!

--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
@@ -57,19 +57,10 @@
 static int Eflag, Sflag, cflag, kflag, sflag;
 
 static void
-cleanobjects(void)
-{
-	int i;
-
-	for (i = 0; i < objtmp.n; ++i)
-		unlink(objtmp.f[i]);
-}
-
-static void
 terminate(void)
 {
 	struct tool *t;
-	int tool, failed = -1;
+	int i, tool, failed = -1;
 
 	for (tool = 0; tool < LAST_TOOL; ++tool) {
 		t = &tools[tool];
@@ -81,6 +72,11 @@
 				unlink(t->outfile);
 		}
 	}
+
+	if (!kflag) {
+		for (i = 0; i < objtmp.n; ++i)
+			unlink(objtmp.f[i]);
+	}
 }
 
 static char **
@@ -464,9 +460,6 @@
 		spawn(settool(inittool(STRIP), NULL, LAST_TOOL));
 		validatetools();
 	}
-
-	if (!kflag)
-		cleanobjects();
 
 	return 0;
 }