git-svn: trunk@3901
Tomasz Kojm authored on 2008/07/02 20:54:26... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Wed Jul 2 13:24:25 CEST 2008 (tk) |
|
2 |
+---------------------------------- |
|
3 |
+ * sigtool/sigtool.c: make use of the UNLINK command in cdiffs (bb#1080) |
|
4 |
+ |
|
1 | 5 |
Wed Jul 2 12:43:46 CEST 2008 (tk) |
2 | 6 |
---------------------------------- |
3 | 7 |
* 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) |
1506 | 1506 |
FILE *diff; |
1507 | 1507 |
DIR *dd; |
1508 | 1508 |
struct dirent *dent; |
1509 |
- char cwd[512], opath[1024]; |
|
1509 |
+ char cwd[512], path[1024]; |
|
1510 | 1510 |
|
1511 | 1511 |
|
1512 | 1512 |
if(!getcwd(cwd, sizeof(cwd))) { |
... | ... |
@@ -1539,8 +1539,8 @@ static int diffdirs(const char *old, const char *new, const char *patch) |
1539 | 1539 |
if(!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) |
1540 | 1540 |
continue; |
1541 | 1541 |
|
1542 |
- snprintf(opath, sizeof(opath), "%s/%s", old, dent->d_name); |
|
1543 |
- if(compare(opath, dent->d_name, diff) == -1) { |
|
1542 |
+ snprintf(path, sizeof(path), "%s/%s", old, dent->d_name); |
|
1543 |
+ if(compare(path, dent->d_name, diff) == -1) { |
|
1544 | 1544 |
fclose(diff); |
1545 | 1545 |
unlink(patch); |
1546 | 1546 |
closedir(dd); |
... | ... |
@@ -1548,7 +1548,28 @@ static int diffdirs(const char *old, const char *new, const char *patch) |
1548 | 1548 |
} |
1549 | 1549 |
} |
1550 | 1550 |
} |
1551 |
+ closedir(dd); |
|
1552 |
+ |
|
1553 |
+ /* check for removed files */ |
|
1554 |
+ if((dd = opendir(old)) == NULL) { |
|
1555 |
+ mprintf("!diffdirs: Can't open directory %s\n", old); |
|
1556 |
+ fclose(diff); |
|
1557 |
+ return -1; |
|
1558 |
+ } |
|
1551 | 1559 |
|
1560 |
+ while((dent = readdir(dd))) { |
|
1561 |
+#ifndef C_INTERIX |
|
1562 |
+ if(dent->d_ino) |
|
1563 |
+#endif |
|
1564 |
+ { |
|
1565 |
+ if(!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) |
|
1566 |
+ continue; |
|
1567 |
+ |
|
1568 |
+ snprintf(path, sizeof(path), "%s/%s", new, dent->d_name); |
|
1569 |
+ if(access(path, R_OK)) |
|
1570 |
+ fprintf(diff, "UNLINK %s\n", dent->d_name); |
|
1571 |
+ } |
|
1572 |
+ } |
|
1552 | 1573 |
closedir(dd); |
1553 | 1574 |
|
1554 | 1575 |
fclose(diff); |