commit 86d4d2d74051defbe0d27d33ad7bda3ff39408a4
Author:     Quentin Rameau <[email protected]>
AuthorDate: Thu Jun 16 13:12:07 2016 +0200
Commit:     Quentin Rameau <[email protected]>
CommitDate: Fri Jun 17 15:45:08 2016 +0200

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

diff --git a/driver/posix/scc.c b/driver/posix/scc.c
index d3e6b9e..8f4c78e 100644
--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
@@ -57,19 +57,10 @@ static struct objects objtmp, objout;
 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 @@ terminate(void)
                                unlink(t->outfile);
                }
        }
+
+       if (!kflag) {
+               for (i = 0; i < objtmp.n; ++i)
+                       unlink(objtmp.f[i]);
+       }
 }
 
 static char **
@@ -465,8 +461,5 @@ main(int argc, char *argv[])
                validatetools();
        }
 
-       if (!kflag)
-               cleanobjects();
-
        return 0;
 }

Reply via email to