]> git.ipfire.org Git - thirdparty/sarg.git/blobdiff - authfail.c
Check for the return code when deleting a file
[thirdparty/sarg.git] / authfail.c
index 434bb47f4bbcfc80f19ff298ffbe0a72009d39b7..6e411692c0c32d625f8aeee2b59e9c34cea2a8b6 100644 (file)
@@ -82,7 +82,10 @@ void authfail_report(void)
                debuga(_("sort command: %s\n"),csort);
                exit(EXIT_FAILURE);
        }
-       unlink(tmp4);
+       if (unlink(tmp4)) {
+               debuga(_("Cannot delete %s - %s\n"),tmp4,strerror(errno));
+               exit(EXIT_FAILURE);
+       }
 
        if((fp_ou=MY_FOPEN(report,"w"))==NULL) {
                debuga(_("(authfail) Cannot open file %s\n"),report);
@@ -190,7 +193,10 @@ void authfail_report(void)
        if (fclose(fp_ou)==EOF)
                debuga(_("Failed to close file %s - %s\n"),report,strerror(errno));
 
-       unlink(authfail_in);
+       if (unlink(authfail_in)) {
+               debuga(_("Cannot delete %s - %s\n"),authfail_in,strerror(errno));
+               exit(EXIT_FAILURE);
+       }
 
        return;
 }