sigtool/sigtool.c: make use of the UNLINK command in cdiffs (bb#1080)

git-svn: trunk@3901
remotes/push_mirror/metadata
Tomasz Kojm 17 years ago
parent e669f71e15
commit 5dc9a0676a
  1. 4
      ChangeLog
  2. 27
      sigtool/sigtool.c

@ -1,3 +1,7 @@
Wed Jul 2 13:24:25 CEST 2008 (tk)
----------------------------------
* sigtool/sigtool.c: make use of the UNLINK command in cdiffs (bb#1080)
Wed Jul 2 12:43:46 CEST 2008 (tk)
----------------------------------
* sigtool/sigtool.c: verify MD5's in --run-cdiff

@ -1506,7 +1506,7 @@ static int diffdirs(const char *old, const char *new, const char *patch)
FILE *diff;
DIR *dd;
struct dirent *dent;
char cwd[512], opath[1024];
char cwd[512], path[1024];
if(!getcwd(cwd, sizeof(cwd))) {
@ -1539,8 +1539,8 @@ static int diffdirs(const char *old, const char *new, const char *patch)
if(!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
continue;
snprintf(opath, sizeof(opath), "%s/%s", old, dent->d_name);
if(compare(opath, dent->d_name, diff) == -1) {
snprintf(path, sizeof(path), "%s/%s", old, dent->d_name);
if(compare(path, dent->d_name, diff) == -1) {
fclose(diff);
unlink(patch);
closedir(dd);
@ -1548,7 +1548,28 @@ static int diffdirs(const char *old, const char *new, const char *patch)
}
}
}
closedir(dd);
/* check for removed files */
if((dd = opendir(old)) == NULL) {
mprintf("!diffdirs: Can't open directory %s\n", old);
fclose(diff);
return -1;
}
while((dent = readdir(dd))) {
#ifndef C_INTERIX
if(dent->d_ino)
#endif
{
if(!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
continue;
snprintf(path, sizeof(path), "%s/%s", new, dent->d_name);
if(access(path, R_OK))
fprintf(diff, "UNLINK %s\n", dent->d_name);
}
}
closedir(dd);
fclose(diff);

Loading…
Cancel
Save