git-svn: trunk@4127
Török Edvin authored on 2008/08/22 00:58:02... | ... |
@@ -132,8 +132,11 @@ void virusaction(const char *filename, const char *virname, const struct cfgstru |
132 | 132 |
} |
133 | 133 |
} |
134 | 134 |
|
135 |
- if(!cmd) |
|
135 |
+ if(!cmd) { |
|
136 |
+ free(buffer_file); |
|
137 |
+ free(buffer_vir); |
|
136 | 138 |
return; |
139 |
+ } |
|
137 | 140 |
/* We can only call async-signal-safe functions after fork(). */ |
138 | 141 |
pid = fork(); |
139 | 142 |
|
... | ... |
@@ -688,7 +688,7 @@ int acceptloop_th(int *socketds, int nsockets, struct cl_engine *engine, unsigne |
688 | 688 |
time(&reloaded_time); |
689 | 689 |
pthread_mutex_unlock(&reload_mutex); |
690 | 690 |
#ifdef CLAMUKO |
691 |
- if(cfgopt(copt, "ClamukoScanOnAccess")->enabled) { |
|
691 |
+ if(cfgopt(copt, "ClamukoScanOnAccess")->enabled && tharg) { |
|
692 | 692 |
logg("Stopping and restarting Clamuko.\n"); |
693 | 693 |
pthread_kill(clamuko_pid, SIGUSR1); |
694 | 694 |
pthread_join(clamuko_pid, NULL); |
... | ... |
@@ -1465,7 +1465,7 @@ static int cli_html_normalise(int fd, m_area_t *m_area, const char *dirname, tag |
1465 | 1465 |
cli_dbgmsg("RFC2397 data file: %s\n", tmp_file); |
1466 | 1466 |
file_tmp_o1->fd = open(tmp_file, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR|S_IRUSR); |
1467 | 1467 |
free(tmp_file); |
1468 |
- if (!file_tmp_o1->fd) { |
|
1468 |
+ if (file_tmp_o1->fd < 0) { |
|
1469 | 1469 |
cli_dbgmsg("open failed: %s\n", filename); |
1470 | 1470 |
free(file_tmp_o1); |
1471 | 1471 |
goto abort; |
... | ... |
@@ -1665,12 +1665,14 @@ abort: |
1665 | 1665 |
} |
1666 | 1666 |
if (file_buff_o2) { |
1667 | 1667 |
html_output_flush(file_buff_o2); |
1668 |
- close(file_buff_o2->fd); |
|
1668 |
+ if(file_buff_o2->fd != -1) |
|
1669 |
+ close(file_buff_o2->fd); |
|
1669 | 1670 |
free(file_buff_o2); |
1670 | 1671 |
} |
1671 | 1672 |
if(file_buff_text) { |
1672 | 1673 |
html_output_flush(file_buff_text); |
1673 |
- close(file_buff_text->fd); |
|
1674 |
+ if(file_buff_text->fd != -1) |
|
1675 |
+ close(file_buff_text->fd); |
|
1674 | 1676 |
free(file_buff_text); |
1675 | 1677 |
} |
1676 | 1678 |
return retval; |
... | ... |
@@ -1739,7 +1741,7 @@ int html_screnc_decode(int fd, const char *dirname) |
1739 | 1739 |
snprintf(filename, 1024, "%s/screnc.html", dirname); |
1740 | 1740 |
ofd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR|S_IRUSR); |
1741 | 1741 |
|
1742 |
- if (!ofd) { |
|
1742 |
+ if (ofd < 0) { |
|
1743 | 1743 |
cli_dbgmsg("open failed: %s\n", filename); |
1744 | 1744 |
fclose(stream_in); |
1745 | 1745 |
return FALSE; |
... | ... |
@@ -287,8 +287,10 @@ cli_vba_readdir(const char *dir, struct uniq *U, uint32_t which) |
287 | 287 |
|
288 | 288 |
i = vba_read_project_strings(fd, TRUE); |
289 | 289 |
seekback = lseek(fd, 0, SEEK_CUR); |
290 |
- if (lseek(fd, sizeof(struct vba56_header), SEEK_SET) == -1) |
|
290 |
+ if (lseek(fd, sizeof(struct vba56_header), SEEK_SET) == -1) { |
|
291 |
+ close(fd); |
|
291 | 292 |
return NULL; |
293 |
+ } |
|
292 | 294 |
j = vba_read_project_strings(fd, FALSE); |
293 | 295 |
if(!i && !j) { |
294 | 296 |
close(fd); |