... | ... |
@@ -92,7 +92,7 @@ int localserver(const struct optstruct *opts) |
92 | 92 |
close(sockfd); |
93 | 93 |
return -1; |
94 | 94 |
} |
95 |
- } else if(STAT(server.sun_path, &foo) != -1) { |
|
95 |
+ } else if(CLAMSTAT(server.sun_path, &foo) != -1) { |
|
96 | 96 |
logg("!LOCAL: Socket file %s exists. Either remove it, or configure a different one.\n", server.sun_path); |
97 | 97 |
close(sockfd); |
98 | 98 |
return -1; |
... | ... |
@@ -325,7 +325,7 @@ int scan_pathchk(const char *path, struct cli_ftw_cbdata *data) |
325 | 325 |
} |
326 | 326 |
|
327 | 327 |
if(!optget(scandata->opts, "CrossFilesystems")->enabled) { |
328 |
- if(STAT(path, &statbuf) == 0) { |
|
328 |
+ if(CLAMSTAT(path, &statbuf) == 0) { |
|
329 | 329 |
if(statbuf.st_dev != scandata->dev) { |
330 | 330 |
if(scandata->type != TYPE_MULTISCAN) |
331 | 331 |
conn_reply_single(scandata->conn, path, "Excluded (another filesystem)"); |
... | ... |
@@ -236,7 +236,7 @@ int command(client_conn_t *conn, int *virus) |
236 | 236 |
int multiscan, max, alive; |
237 | 237 |
|
238 | 238 |
/* use MULTISCAN only for directories (bb #1869) */ |
239 |
- if (STAT(conn->filename, &sb) == 0 && |
|
239 |
+ if (CLAMSTAT(conn->filename, &sb) == 0 && |
|
240 | 240 |
!S_ISDIR(sb.st_mode)) { |
241 | 241 |
thrmgr_setactivetask(NULL, "CONTSCAN"); |
242 | 242 |
type = TYPE_CONTSCAN; |
... | ... |
@@ -384,7 +384,7 @@ int command(client_conn_t *conn, int *virus) |
384 | 384 |
flags |= CLI_FTW_FOLLOW_FILE_SYMLINK; |
385 | 385 |
|
386 | 386 |
if(!optget(opts, "CrossFilesystems")->enabled) |
387 |
- if(STAT(conn->filename, &sb) == 0) |
|
387 |
+ if(CLAMSTAT(conn->filename, &sb) == 0) |
|
388 | 388 |
scandata.dev = sb.st_dev; |
389 | 389 |
|
390 | 390 |
ret = cli_ftw(conn->filename, flags, maxdirrec ? maxdirrec : INT_MAX, scan_callback, &data, scan_pathchk); |
... | ... |
@@ -296,7 +296,7 @@ int dsresult(int sockd, int scantype, const char *filename, int *printok, int *e |
296 | 296 |
logg("STDIN: noreply from clamd\n."); |
297 | 297 |
return -1; |
298 | 298 |
} |
299 |
- if(STAT(filename, &sb) == -1) { |
|
299 |
+ if(CLAMSTAT(filename, &sb) == -1) { |
|
300 | 300 |
logg("~%s: stat() failed with %s, clamd may not be responding\n", |
301 | 301 |
filename, strerror(errno)); |
302 | 302 |
return -1; |
... | ... |
@@ -249,7 +249,7 @@ static void scanfile(const char *filename, struct cl_engine *engine, const struc |
249 | 249 |
} |
250 | 250 |
|
251 | 251 |
/* argh, don't scan /proc files */ |
252 |
- if(STAT(filename, &sb) != -1) { |
|
252 |
+ if(CLAMSTAT(filename, &sb) != -1) { |
|
253 | 253 |
#ifdef C_LINUX |
254 | 254 |
if(procdev && sb.st_dev == procdev) { |
255 | 255 |
if(!printinfected) |
... | ... |
@@ -412,7 +412,7 @@ static void scandirs(const char *dirname, struct cl_engine *engine, const struct |
412 | 412 |
if(dirlnk != 2 && filelnk != 2) { |
413 | 413 |
if(!printinfected) |
414 | 414 |
logg("%s: Symbolic link\n", fname); |
415 |
- } else if(STAT(fname, &sb) != -1) { |
|
415 |
+ } else if(CLAMSTAT(fname, &sb) != -1) { |
|
416 | 416 |
if(S_ISREG(sb.st_mode) && filelnk == 2) { |
417 | 417 |
scanfile(fname, engine, opts, options); |
418 | 418 |
} else if(S_ISDIR(sb.st_mode) && dirlnk == 2) { |
... | ... |
@@ -884,7 +884,7 @@ int scanmanager(const struct optstruct *opts) |
884 | 884 |
|
885 | 885 |
#ifdef C_LINUX |
886 | 886 |
procdev = (dev_t) 0; |
887 |
- if(STAT("/proc", &sb) != -1 && !sb.st_size) |
|
887 |
+ if(CLAMSTAT("/proc", &sb) != -1 && !sb.st_size) |
|
888 | 888 |
procdev = sb.st_dev; |
889 | 889 |
#endif |
890 | 890 |
|
... | ... |
@@ -895,7 +895,7 @@ int scanmanager(const struct optstruct *opts) |
895 | 895 |
logg("!Can't get absolute pathname of current working directory\n"); |
896 | 896 |
ret = 2; |
897 | 897 |
} else { |
898 |
- STAT(cwd, &sb); |
|
898 |
+ CLAMSTAT(cwd, &sb); |
|
899 | 899 |
scandirs(cwd, engine, opts, options, 1, sb.st_dev); |
900 | 900 |
} |
901 | 901 |
|
... | ... |
@@ -923,7 +923,7 @@ int scanmanager(const struct optstruct *opts) |
923 | 923 |
if(dirlnk == 0 && filelnk == 0) { |
924 | 924 |
if(!printinfected) |
925 | 925 |
logg("%s: Symbolic link\n", file); |
926 |
- } else if(STAT(file, &sb) != -1) { |
|
926 |
+ } else if(CLAMSTAT(file, &sb) != -1) { |
|
927 | 927 |
if(S_ISREG(sb.st_mode) && filelnk) { |
928 | 928 |
scanfile(file, engine, opts, options); |
929 | 929 |
} else if(S_ISDIR(sb.st_mode) && dirlnk) { |
... | ... |
@@ -333,7 +333,7 @@ main (int argc, char **argv) |
333 | 333 |
|
334 | 334 |
if (optget (opts, "HTTPProxyPassword")->enabled) |
335 | 335 |
{ |
336 |
- if (STAT (cfgfile, &statbuf) == -1) |
|
336 |
+ if (CLAMSTAT (cfgfile, &statbuf) == -1) |
|
337 | 337 |
{ |
338 | 338 |
logg ("^Can't stat %s (critical error)\n", cfgfile); |
339 | 339 |
optfree (opts); |
... | ... |
@@ -2621,7 +2621,7 @@ updatecustomdb (const char *url, int *signo, const struct optstruct *opts, |
2621 | 2621 |
rtimeout = optget (opts, "ReceiveTimeout")->numarg; |
2622 | 2622 |
|
2623 | 2623 |
*mtime = 0; |
2624 |
- if (STAT (dbname, &sb) != -1) |
|
2624 |
+ if (CLAMSTAT (dbname, &sb) != -1) |
|
2625 | 2625 |
Rfc2822DateTime (mtime, sb.st_mtime); |
2626 | 2626 |
|
2627 | 2627 |
newfile = cli_gentemp (updtmpdir); |
... | ... |
@@ -29,14 +29,14 @@ |
29 | 29 |
#include <unistd.h> |
30 | 30 |
|
31 | 31 |
#define STATBUF struct stat64 |
32 |
-#define STAT stat64 |
|
32 |
+#define CLAMSTAT stat64 |
|
33 | 33 |
#define LSTAT lstat64 |
34 | 34 |
#define FSTAT fstat64 |
35 | 35 |
#define safe_open(a, b) open(a, b|O_LARGEFILE) |
36 | 36 |
#else |
37 | 37 |
|
38 | 38 |
#define STATBUF struct stat |
39 |
-#define STAT stat |
|
39 |
+#define CLAMSTAT stat |
|
40 | 40 |
#define LSTAT lstat |
41 | 41 |
#define FSTAT fstat |
42 | 42 |
/* Nothing is safe in windows, not even open, safe_open defined under /win32 */ |
... | ... |
@@ -2813,7 +2813,7 @@ rfc1341(message *m, const char *dir) |
2813 | 2813 |
} else if(errno == EEXIST) { |
2814 | 2814 |
STATBUF statb; |
2815 | 2815 |
|
2816 |
- if(STAT(pdir, &statb) < 0) { |
|
2816 |
+ if(CLAMSTAT(pdir, &statb) < 0) { |
|
2817 | 2817 |
char err[128]; |
2818 | 2818 |
cli_errmsg("Partial directory %s: %s\n", pdir, |
2819 | 2819 |
cli_strerror(errno, err, sizeof(err))); |
... | ... |
@@ -903,7 +903,7 @@ cli_rmdirs(const char *name) |
903 | 903 |
char err[128]; |
904 | 904 |
|
905 | 905 |
|
906 |
- if(STAT(name, &statb) < 0) { |
|
906 |
+ if(CLAMSTAT(name, &statb) < 0) { |
|
907 | 907 |
cli_warnmsg("cli_rmdirs: Can't locate %s: %s\n", name, cli_strerror(errno, err, sizeof(err))); |
908 | 908 |
return -1; |
909 | 909 |
} |
... | ... |
@@ -974,7 +974,7 @@ int cli_rmdirs(const char *dirname) |
974 | 974 |
|
975 | 975 |
chmod(dirname, 0700); |
976 | 976 |
if((dd = opendir(dirname)) != NULL) { |
977 |
- while(STAT(dirname, &maind) != -1) { |
|
977 |
+ while(CLAMSTAT(dirname, &maind) != -1) { |
|
978 | 978 |
if(!rmdir(dirname)) break; |
979 | 979 |
if(errno != ENOTEMPTY && errno != EEXIST && errno != EBADF) { |
980 | 980 |
cli_errmsg("cli_rmdirs: Can't remove temporary directory %s: %s\n", dirname, cli_strerror(errno, err, sizeof(err))); |
... | ... |
@@ -2901,7 +2901,7 @@ int cl_load(const char *path, struct cl_engine *engine, unsigned int *signo, uns |
2901 | 2901 |
return CL_EARG; |
2902 | 2902 |
} |
2903 | 2903 |
|
2904 |
- if(STAT(path, &sb) == -1) { |
|
2904 |
+ if(CLAMSTAT(path, &sb) == -1) { |
|
2905 | 2905 |
cli_errmsg("cl_load(): Can't get status of %s\n", path); |
2906 | 2906 |
return CL_ESTAT; |
2907 | 2907 |
} |
... | ... |
@@ -3021,7 +3021,7 @@ int cl_statinidir(const char *dirname, struct cl_stat *dbstat) |
3021 | 3021 |
|
3022 | 3022 |
strcpy(dbstat->statdname[dbstat->entries - 1], dent->d_name); |
3023 | 3023 |
#endif |
3024 |
- STAT(fname, &dbstat->stattab[dbstat->entries - 1]); |
|
3024 |
+ CLAMSTAT(fname, &dbstat->stattab[dbstat->entries - 1]); |
|
3025 | 3025 |
free(fname); |
3026 | 3026 |
} |
3027 | 3027 |
} |
... | ... |
@@ -3076,7 +3076,7 @@ int cl_statchkdir(const struct cl_stat *dbstat) |
3076 | 3076 |
} |
3077 | 3077 |
|
3078 | 3078 |
sprintf(fname, "%s"PATHSEP"%s", dbstat->dir, dent->d_name); |
3079 |
- STAT(fname, &sb); |
|
3079 |
+ CLAMSTAT(fname, &sb); |
|
3080 | 3080 |
free(fname); |
3081 | 3081 |
|
3082 | 3082 |
found = 0; |
... | ... |
@@ -3426,7 +3426,7 @@ int cl_countsigs(const char *path, unsigned int countoptions, unsigned int *sigs |
3426 | 3426 |
if(!sigs) |
3427 | 3427 |
return CL_ENULLARG; |
3428 | 3428 |
|
3429 |
- if(STAT(path, &sb) == -1) { |
|
3429 |
+ if(CLAMSTAT(path, &sb) == -1) { |
|
3430 | 3430 |
cli_errmsg("cl_countsigs: Can't stat %s\n", path); |
3431 | 3431 |
return CL_ESTAT; |
3432 | 3432 |
} |
... | ... |
@@ -123,7 +123,7 @@ static void action_remove(const char *filename) { |
123 | 123 |
|
124 | 124 |
static int isdir(void) { |
125 | 125 |
STATBUF sb; |
126 |
- if(STAT(actarget, &sb) || !S_ISDIR(sb.st_mode)) { |
|
126 |
+ if(CLAMSTAT(actarget, &sb) || !S_ISDIR(sb.st_mode)) { |
|
127 | 127 |
logg("!'%s' doesn't exist or is not a directory\n", actarget); |
128 | 128 |
return 0; |
129 | 129 |
} |
... | ... |
@@ -172,7 +172,7 @@ static int hashsig(const struct optstruct *opts, unsigned int mdb, int type) |
172 | 172 |
|
173 | 173 |
if(opts->filename) { |
174 | 174 |
for(i = 0; opts->filename[i]; i++) { |
175 |
- if(STAT(opts->filename[i], &sb) == -1) { |
|
175 |
+ if(CLAMSTAT(opts->filename[i], &sb) == -1) { |
|
176 | 176 |
mprintf("!hashsig: Can't access file %s\n", opts->filename[i]); |
177 | 177 |
perror("hashsig"); |
178 | 178 |
return -1; |
... | ... |
@@ -523,7 +523,7 @@ static int script2cdiff(const char *script, const char *builder, const struct op |
523 | 523 |
int bytes; |
524 | 524 |
|
525 | 525 |
|
526 |
- if(STAT(script, &sb) == -1) { |
|
526 |
+ if(CLAMSTAT(script, &sb) == -1) { |
|
527 | 527 |
mprintf("!script2diff: Can't stat file %s\n", script); |
528 | 528 |
return -1; |
529 | 529 |
} |
... | ... |
@@ -669,7 +669,7 @@ static int build(const struct optstruct *opts) |
669 | 669 |
if(optget(opts, "datadir")->active) |
670 | 670 |
localdbdir = optget(opts, "datadir")->strarg; |
671 | 671 |
|
672 |
- if(STAT("COPYING", &foo) == -1) { |
|
672 |
+ if(CLAMSTAT("COPYING", &foo) == -1) { |
|
673 | 673 |
mprintf("!build: COPYING file not found in current working directory.\n"); |
674 | 674 |
return -1; |
675 | 675 |
} |
... | ... |
@@ -1444,7 +1444,7 @@ static int listsigs(const struct optstruct *opts, int mode) |
1444 | 1444 |
name = optget(opts, "list-sigs")->strarg; |
1445 | 1445 |
if(access(name, R_OK) && localdbdir) |
1446 | 1446 |
name = localdbdir; |
1447 |
- if(STAT(name, &sb) == -1) { |
|
1447 |
+ if(CLAMSTAT(name, &sb) == -1) { |
|
1448 | 1448 |
mprintf("--list-sigs: Can't get status of %s\n", name); |
1449 | 1449 |
return -1; |
1450 | 1450 |
} |
... | ... |
@@ -1837,7 +1837,7 @@ static int dircopy(const char *src, const char *dest) |
1837 | 1837 |
char spath[512], dpath[512]; |
1838 | 1838 |
|
1839 | 1839 |
|
1840 |
- if(STAT(dest, &sb) == -1) { |
|
1840 |
+ if(CLAMSTAT(dest, &sb) == -1) { |
|
1841 | 1841 |
if(mkdir(dest, 0755)) { |
1842 | 1842 |
/* mprintf("!dircopy: Can't create temporary directory %s\n", dest); */ |
1843 | 1843 |
return -1; |
... | ... |
@@ -3039,7 +3039,7 @@ int main(int argc, char **argv) |
3039 | 3039 |
mprintf("!--verify-cdiff requires two arguments\n"); |
3040 | 3040 |
ret = -1; |
3041 | 3041 |
} else { |
3042 |
- if(STAT(opts->filename[0], &sb) == -1) { |
|
3042 |
+ if(CLAMSTAT(opts->filename[0], &sb) == -1) { |
|
3043 | 3043 |
mprintf("--verify-cdiff: Can't get status of %s\n", opts->filename[0]); |
3044 | 3044 |
ret = -1; |
3045 | 3045 |
} else { |
... | ... |
@@ -350,7 +350,7 @@ static size_t prepare_instream(char *buf, size_t off, size_t buflen) |
350 | 350 |
STATBUF stbuf; |
351 | 351 |
int fd, nread; |
352 | 352 |
uint32_t chunk; |
353 |
- fail_unless_fmt(STAT(SCANFILE, &stbuf) != -1, "stat failed for %s: %s", SCANFILE, strerror(errno)); |
|
353 |
+ fail_unless_fmt(CLAMSTAT(SCANFILE, &stbuf) != -1, "stat failed for %s: %s", SCANFILE, strerror(errno)); |
|
354 | 354 |
|
355 | 355 |
fd = open(SCANFILE, O_RDONLY); |
356 | 356 |
fail_unless_fmt(fd != -1, "open failed: %s\n", strerror(errno)); |