git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@311 77e5149b-7576-45b1-b177-96237e5ba77b
Thomas Lamy authored on 2004/02/19 20:15:10... | ... |
@@ -31,6 +31,7 @@ |
31 | 31 |
#include <stdlib.h> |
32 | 32 |
#include <ctype.h> |
33 | 33 |
#include <unistd.h> |
34 |
+#include <errno.h> |
|
34 | 35 |
#include <sys/types.h> |
35 | 36 |
#include <sys/stat.h> |
36 | 37 |
#include <sys/wait.h> |
... | ... |
@@ -129,12 +130,20 @@ int logg(const char *str, ...) |
129 | 129 |
|
130 | 130 |
if(logfile) { |
131 | 131 |
|
132 |
+ if (str == NULL && fd != NULL) { |
|
133 |
+ /* re-open logfile */ |
|
134 |
+ fclose(fd); |
|
135 |
+ fd = NULL; |
|
136 |
+ } |
|
132 | 137 |
if(!fd) { |
133 | 138 |
if((fd = fopen(logfile, "a")) == NULL) { |
134 |
- mprintf("!LOGGER: Can't open file %s to write.\n", logfile); |
|
139 |
+ mprintf("!LOGGER: Can't open %s for writing: %s.\n", logfile, strerror(errno)); |
|
135 | 140 |
return 1; |
136 | 141 |
} |
137 | 142 |
} |
143 |
+ if (str == NULL) { |
|
144 |
+ return 0; |
|
145 |
+ } |
|
138 | 146 |
|
139 | 147 |
va_start(args, str); |
140 | 148 |
|