shithub: scc

Download patch

ref: c75555ca9951a5433703c0bb70f6a7ff6d0dfb1d
parent: 8d97921d9f3aa8a3adf3030401da4c7c580074a5
author: Quentin Rameau <quinq@fifth.space>
date: Sat Jun 4 08:28:02 EDT 2016

[driver] remove cleanup: clean in build and terminate

Unlink failed files only on error, when terminate is called.

--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
@@ -46,23 +46,6 @@
 static int Eflag, Sflag, kflag;
 
 static void
-cleanup(void)
-{
-	struct tool *t;
-	int i;
-
-	for (i = 0; i < NR_TOOLS + 1; ++i) {
-		t = &tools[i];
-		if (t->outfile) {
-			if (i > failedtool)
-				unlink(t->outfile);
-			free(t->outfile);
-			t->outfile = NULL;
-		}
-	}
-}
-
-static void
 terminate(void)
 {
 	struct tool *t;
@@ -306,7 +289,10 @@
 	for (i = 0; i < NR_TOOLS; ++i)
 		checktool(i);
 
-	cleanup();
+	for (i = 0; i < NR_TOOLS; ++i) {
+		free(tools[i].outfile);
+		tools[i].outfile = NULL;
+	}
 }
 
 static void