From a5267dd612c697b95a588c033323407d6a7faf32 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20Marchal?= Date: Wed, 9 Feb 2011 20:46:37 +0000 Subject: [PATCH] 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. --- html.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); -- 2.47.2