keep proper file order when building .cld file

git-svn: trunk@3667
This commit is contained in:
Tomasz Kojm
2008-02-21 19:00:54 +00:00
parent 77404545b3
commit c1908ce710
2 changed files with 33 additions and 2 deletions

View File

@@ -1,3 +1,7 @@
Thu Feb 21 19:00:45 CET 2008 (tk)
---------------------------------
* freshclam/manager.c: keep proper file order when building .cld file
Thu Feb 21 15:29:48 CET 2008 (tk)
---------------------------------
* clamd/server-th.c: fix compilation error on Tru64 (bb#829)

View File

@@ -826,7 +826,7 @@ static int buildcld(const char *tmpdir, const char *dbname, const char *newfile,
DIR *dir;
char cwd[512], info[32], buff[512], *pt;
struct dirent *dent;
int fd;
int fd, err = 0;
gzFile *gzs = NULL;
@@ -890,12 +890,39 @@ static int buildcld(const char *tmpdir, const char *dbname, const char *newfile,
}
}
if(access("COPYING", R_OK)) {
logg("!buildcld: COPYING file not found\n");
err = 1;
} else {
if(tar_addfile(fd, gzs, "COPYING") == -1) {
logg("!buildcld: Can't add COPYING to .cld file\n");
err = 1;
}
}
if(!err && !access("daily.cfg", R_OK)) {
if(tar_addfile(fd, gzs, "daily.cfg") == -1) {
logg("!buildcld: Can't add daily.cfg to .cld file\n");
err = 1;
}
}
if(err) {
chdir(cwd);
if(gzs)
gzclose(gzs);
else
close(fd);
unlink(newfile);
return -1;
}
while((dent = readdir(dir))) {
#ifndef C_INTERIX
if(dent->d_ino)
#endif
{
if(!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
if(!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..") || !strcmp(dent->d_name, "COPYING") || !strcmp(dent->d_name, "daily.cfg"))
continue;
if(tar_addfile(fd, gzs, dent->d_name) == -1) {