From: Frédéric Marchal Date: Wed, 9 Feb 2011 20:46:37 +0000 (+0000) Subject: Don't delete a file twice if -i is given on the command line X-Git-Tag: v2.3.2~68 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a5267dd612c697b95a588c033323407d6a7faf32;p=thirdparty%2Fsarg.git Don't delete a file twice if -i is given on the command line If sarg is ran with command line option -i, in some circunstances I have yet to clarify, the ip file is not produced. In that case, the name of the previously created file (whose name is still in the string buffer) is deleted a second time. The result is a failure as the file doesn't exists any more. Thanks to Arnaud Florent for reporting this bug. --- diff --git a/html.c b/html.c index 74dd443..5d62d76 100644 --- a/html.c +++ b/html.c @@ -235,6 +235,7 @@ void htmlrel(void) debuga(_("Making report: %s\n"),uinfo->id); } count=0; + arqip[0]='\0'; while((buf=longline_read(fp_in,line))!=NULL) { getword_start(&gwarea,buf); @@ -498,7 +499,7 @@ void htmlrel(void) fclose(fp_in); longline_destroy(&line); - if (iprel) { + if (iprel && arqip[0]) { if (unlink(arqip)) { debuga(_("Cannot delete %s - %s\n"),arqip,strerror(errno)); exit(EXIT_FAILURE);