]> git.ipfire.org Git - thirdparty/sarg.git/blobdiff - realtime.c
Check for the return code when deleting a file
[thirdparty/sarg.git] / realtime.c
index 6dc382cc723c8c5fdd581e7c55d1f5249ee5b908..a38375ec6e9b2ccb7e5f9d3e003110d1cf160604 100755 (executable)
@@ -86,7 +86,10 @@ static void getlog(void)
                debuga(_("sort command: %s\n"),cmd);
                exit(EXIT_FAILURE);
        }
-       unlink(template1);
+       if (unlink(template1)) {
+               debuga(_("Cannot delete %s - %s\n"),template1,strerror(errno));
+               exit(EXIT_FAILURE);
+       }
        datashow(template2);
 }
 
@@ -268,7 +271,10 @@ static void datashow(const char *tmp)
 
        puts("</table>\n</div>\n</body>\n</html>\n");
        fclose(fin);
-       unlink(tmp);
+       if (unlink(tmp)) {
+               debuga(_("Cannot delete %s - %s\n"),tmp,strerror(errno));
+               exit(EXIT_FAILURE);
+       }
        fflush(NULL);
 }