outstack: error checking
authorAlan Cox <alan@linux.intel.com>
Wed, 20 Sep 2017 13:01:35 +0000 (14:01 +0100)
committerAlan Cox <alan@linux.intel.com>
Wed, 20 Sep 2017 13:01:35 +0000 (14:01 +0100)
Applications/SmallC/outstack.c

index 8c6724e..5d7506a 100644 (file)
@@ -64,6 +64,10 @@ void end_defer(void)
 
 void defer_init(void)
 {
-    defer = open("scc-spool", O_RDWR|O_CREAT|O_TRUNC, 0600);
-//    unlink("scc-spool");
+    defer = open(".scc-spool", O_RDWR|O_CREAT|O_TRUNC, 0600);
+    if (defer == -1) {
+        error("tmp file open failed");
+        exit(1);
+    }
+    unlink("scc-spool");
 }