summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2006-01-21 22:18:59 +0000
committerAndreas Gruenbacher <agruen@suse.de>2006-01-21 22:18:59 +0000
commit2a6d98e022f7141978191f5b7f80c85d78292478 (patch)
treee4dbadc313b84002e6b9160ccc2cfcd31d90896c
parente123d84425ed9128a2230bf6dcf66b39018d520f (diff)
downloadquilt-2a6d98e022f7141978191f5b7f80c85d78292478.tar.gz
- lib/backup-files.c: Only create and remove parents that are
missing or empty. Report errors in nftw. (Minor changes by agruen@suse.de).
-rw-r--r--lib/backup-files.c57
-rw-r--r--po/de.po18
-rw-r--r--po/fr.po18
-rw-r--r--po/ja.po18
-rw-r--r--po/quilt.pot18
-rw-r--r--quilt.changes7
6 files changed, 77 insertions, 59 deletions
diff --git a/lib/backup-files.c b/lib/backup-files.c
index 161ea1c..75c5dcc 100644
--- a/lib/backup-files.c
+++ b/lib/backup-files.c
@@ -94,43 +94,49 @@ void
create_parents(const char *filename)
{
struct stat st;
+ int rv = -1;
char *fn = malloc_nofail(strlen(filename) + 1), *f;
strcpy(fn, filename);
- f = strchr(fn, '/');
+
+ f = strrchr(fn, '/');
+ if (f == NULL)
+ return;
+ *f = '\0';
+ if (stat(fn, &st) == 0)
+ return;
+ *f = '/';
- if (f != NULL) {
+ f = strchr(fn, '/');
+ while (f != NULL) {
*f = '\0';
- if (stat(f, &st) != 0) {
- while (f != NULL) {
- *f = '\0';
- mkdir(fn, 0777);
- *f = '/';
- f = strchr(f+1, '/');
- }
- } else {
- *f = '/';
+ if (!rv || (rv = stat(fn, &st)) != 0) {
+ mkdir(fn, 0777);
}
+ *f = '/';
+ f = strchr(f+1, '/');
}
free(fn);
}
void
-remove_parents(char *filename)
+remove_parents(const char *filename)
{
- char *f, *g = NULL;
+ char *fn = malloc_nofail(strlen(filename) + 1), *f;
- f = strrchr(filename, '/');
- while ((f = strrchr(filename, '/')) != NULL) {
- if (g != NULL)
- *g = '/';
- g = f;
- *f= '\0';
+ strcpy(fn, filename);
- rmdir(filename);
- }
- if (g != NULL)
- *g = '/';
+ f = strrchr(fn, '/');
+ if (f == NULL)
+ return;
+ do {
+ *f = '\0';
+ if (rmdir(fn) == -1)
+ goto out;
+ } while ((f = strrchr(fn, '/')) != NULL);
+ rmdir(fn);
+out:
+ free(fn);
}
static int
@@ -456,6 +462,11 @@ main(int argc, char *argv[])
else
d = ".";
status = nftw(dir, walk, 0, 0);
+ /* An error here indicates a problem somewhere
+ * during the walk */
+ if (status == -1)
+ perror("ftw");
+
free(dir);
} else
status = process_file(argv[optind]);
diff --git a/po/de.po b/po/de.po
index f954676..6175508 100644
--- a/po/de.po
+++ b/po/de.po
@@ -324,11 +324,11 @@ msgstr ""
msgid "Patch %s not applied before patch %s\\n"
msgstr "Patch %s ist nicht vor Patch %s angewandt\\n"
-#: quilt/diff.in:321 quilt/pop.in:101
+#: quilt/diff.in:321 quilt/pop.in:98
msgid "Failed to copy files to temporary directory\\n"
msgstr "Konnte Dateien nicht in temporäres Verzeichnis kopieren\\n"
-#: quilt/diff.in:345 quilt/pop.in:125
+#: quilt/diff.in:345 quilt/pop.in:122
msgid "Failed to patch temporary files\\n"
msgstr "Konnte temporäre Dateien nicht patchen\\n"
@@ -866,33 +866,33 @@ msgstr ""
"\n"
"-v\tViele Meldungen ausgeben.\n"
-#: quilt/pop.in:143
+#: quilt/pop.in:140
msgid "Patch %s does not remove cleanly (refresh it or enforce with -f)\\n"
msgstr ""
"Patch %s kann nicht entfernt werden (Patch auffrischen oder Entfernen "
"erzwingen mit -f)\\n"
-#: quilt/pop.in:168
+#: quilt/pop.in:165
msgid "Patch %s appears to be empty, removing\\n"
msgstr "Patch %s scheint leer zu sein; wird entfernt\\n"
-#: quilt/pop.in:172
+#: quilt/pop.in:169
msgid "Removing patch %s\\n"
msgstr "Entferne patch %s\\n"
-#: quilt/pop.in:243
+#: quilt/pop.in:240
msgid "Patch %s needs to be refreshed first.\\n"
msgstr "Patch %s muss zuerst aufgefrischt werden (Refresh).\\n"
-#: quilt/pop.in:253
+#: quilt/pop.in:250
msgid "No patch removed\\n"
msgstr "Kein Patch entfernt\\n"
-#: quilt/pop.in:269 quilt/scripts/patchfns.in:455
+#: quilt/pop.in:266 quilt/scripts/patchfns.in:455
msgid "No patches applied\\n"
msgstr "Keine Patches angewandt\\n"
-#: quilt/pop.in:276 quilt/push.in:340
+#: quilt/pop.in:273 quilt/push.in:340
msgid "Now at patch %s\\n"
msgstr "Jetzt in Patch %s\\n"
diff --git a/po/fr.po b/po/fr.po
index 846e244..852f780 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -326,11 +326,11 @@ msgstr ""
msgid "Patch %s not applied before patch %s\\n"
msgstr "Le patch %s n'est pas appliqué avant %s\\n."
-#: quilt/diff.in:321 quilt/pop.in:101
+#: quilt/diff.in:321 quilt/pop.in:98
msgid "Failed to copy files to temporary directory\\n"
msgstr "Impossible de copier les fichiers dans le répertoire temporaire\\n"
-#: quilt/diff.in:345 quilt/pop.in:125
+#: quilt/diff.in:345 quilt/pop.in:122
msgid "Failed to patch temporary files\\n"
msgstr "Impossible de patcher les fichiers temporaires\\n"
@@ -875,33 +875,33 @@ msgstr ""
"\n"
"-v\tOpère verbeusement.\n"
-#: quilt/pop.in:143
+#: quilt/pop.in:140
msgid "Patch %s does not remove cleanly (refresh it or enforce with -f)\\n"
msgstr ""
"Le patch %s ne se retire pas proprement (rafraichissez le, ou forcez avec -f)"
"\\n"
-#: quilt/pop.in:168
+#: quilt/pop.in:165
msgid "Patch %s appears to be empty, removing\\n"
msgstr "Le patch %s semble vide, enlevé\\n"
-#: quilt/pop.in:172
+#: quilt/pop.in:169
msgid "Removing patch %s\\n"
msgstr "Retrait de %s\\n"
-#: quilt/pop.in:243
+#: quilt/pop.in:240
msgid "Patch %s needs to be refreshed first.\\n"
msgstr "Le patch %s doit être rafraichi au préalable.\\n"
-#: quilt/pop.in:253
+#: quilt/pop.in:250
msgid "No patch removed\\n"
msgstr "Aucun patch retiré\\n"
-#: quilt/pop.in:269 quilt/scripts/patchfns.in:455
+#: quilt/pop.in:266 quilt/scripts/patchfns.in:455
msgid "No patches applied\\n"
msgstr "Aucun patch n'est appliqué\\n"
-#: quilt/pop.in:276 quilt/push.in:340
+#: quilt/pop.in:273 quilt/push.in:340
msgid "Now at patch %s\\n"
msgstr "Le patch %s est maintenant au sommet\\n"
diff --git a/po/ja.po b/po/ja.po
index c7e4bed..830eac9 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -315,11 +315,11 @@ msgstr "-p%sã§ãƒ‘ッãƒã®å·®åˆ†ã¯ã¨ã‚Œã¾ã›ã‚“。-p0ã‹ -p1を指定ã—ã¦ã
msgid "Patch %s not applied before patch %s\\n"
msgstr "パッム%s ã¯ã€ãƒ‘ッム%s ã®å‰ã«é©ç”¨ã•ã‚Œã¦ã„ã¾ã›ã‚“\\n"
-#: quilt/diff.in:321 quilt/pop.in:101
+#: quilt/diff.in:321 quilt/pop.in:98
msgid "Failed to copy files to temporary directory\\n"
msgstr "テンãƒãƒ©ãƒªãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã¸ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚³ãƒ”ーã«å¤±æ•—ã—ã¾ã—ãŸ\\n"
-#: quilt/diff.in:345 quilt/pop.in:125
+#: quilt/diff.in:345 quilt/pop.in:122
msgid "Failed to patch temporary files\\n"
msgstr "テンãƒãƒ©ãƒªãƒ•ã‚¡ã‚¤ãƒ«ã¸ã®ãƒ‘ッãƒé©ç”¨ã«å¤±æ•—ã—ã¾ã—ãŸ\\n"
@@ -849,33 +849,33 @@ msgstr ""
"\n"
"-v\t詳細ã«è¡¨ç¤ºã€‚\n"
-#: quilt/pop.in:143
+#: quilt/pop.in:140
msgid "Patch %s does not remove cleanly (refresh it or enforce with -f)\\n"
msgstr ""
"パッム%s ã‚’ã€æ­£å¸¸ã«ã¯ãšã™ã“ã¨ãŒã§ãã¾ã›ã‚“ (リフレッシュã™ã‚‹ã‹ -fを付\n"
"ã‘ã¦ã¯ãšã—ã¦ãã ã•ã„)\\n"
-#: quilt/pop.in:168
+#: quilt/pop.in:165
msgid "Patch %s appears to be empty, removing\\n"
msgstr "パッム%s ã¯ã€ç©ºã®ã‚ˆã†ã§ã™ã€‚ã¯ãšã—ã¾ã™\\n"
-#: quilt/pop.in:172
+#: quilt/pop.in:169
msgid "Removing patch %s\\n"
msgstr "パッム%s ã‚’ã¯ãšã—ã¾ã™\\n"
-#: quilt/pop.in:243
+#: quilt/pop.in:240
msgid "Patch %s needs to be refreshed first.\\n"
msgstr "最åˆã«ã€ãƒ‘ッム%s ã®ãƒªãƒ•ãƒ¬ãƒƒã‚·ãƒ¥ãŒå¿…è¦ã§ã™ã€‚\\n"
-#: quilt/pop.in:253
+#: quilt/pop.in:250
msgid "No patch removed\\n"
msgstr "é©ç”¨ã•ã‚Œã¦ã„るパッãƒã¯ã‚ã‚Šã¾ã›ã‚“\\n"
-#: quilt/pop.in:269 quilt/scripts/patchfns.in:455
+#: quilt/pop.in:266 quilt/scripts/patchfns.in:455
msgid "No patches applied\\n"
msgstr "é©ç”¨ã•ã‚Œã¦ã„るパッãƒã¯ã‚ã‚Šã¾ã›ã‚“\\n"
-#: quilt/pop.in:276 quilt/push.in:340
+#: quilt/pop.in:273 quilt/push.in:340
msgid "Now at patch %s\\n"
msgstr "ç¾åœ¨ä½ç½®ã¯ãƒ‘ッム%s ã§ã™\\n"
diff --git a/po/quilt.pot b/po/quilt.pot
index ea748cf..7e2bb24 100644
--- a/po/quilt.pot
+++ b/po/quilt.pot
@@ -212,11 +212,11 @@ msgstr ""
msgid "Patch %s not applied before patch %s\\n"
msgstr ""
-#: quilt/diff.in:321 quilt/pop.in:101
+#: quilt/diff.in:321 quilt/pop.in:98
msgid "Failed to copy files to temporary directory\\n"
msgstr ""
-#: quilt/diff.in:345 quilt/pop.in:125
+#: quilt/diff.in:345 quilt/pop.in:122
msgid "Failed to patch temporary files\\n"
msgstr ""
@@ -585,31 +585,31 @@ msgid ""
"-v\tVerbose operation.\n"
msgstr ""
-#: quilt/pop.in:143
+#: quilt/pop.in:140
msgid "Patch %s does not remove cleanly (refresh it or enforce with -f)\\n"
msgstr ""
-#: quilt/pop.in:168
+#: quilt/pop.in:165
msgid "Patch %s appears to be empty, removing\\n"
msgstr ""
-#: quilt/pop.in:172
+#: quilt/pop.in:169
msgid "Removing patch %s\\n"
msgstr ""
-#: quilt/pop.in:243
+#: quilt/pop.in:240
msgid "Patch %s needs to be refreshed first.\\n"
msgstr ""
-#: quilt/pop.in:253
+#: quilt/pop.in:250
msgid "No patch removed\\n"
msgstr ""
-#: quilt/pop.in:269 quilt/scripts/patchfns.in:455
+#: quilt/pop.in:266 quilt/scripts/patchfns.in:455
msgid "No patches applied\\n"
msgstr ""
-#: quilt/pop.in:276 quilt/push.in:340
+#: quilt/pop.in:273 quilt/push.in:340
msgid "Now at patch %s\\n"
msgstr ""
diff --git a/quilt.changes b/quilt.changes
index 4d27736..b7b3636 100644
--- a/quilt.changes
+++ b/quilt.changes
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Sat Jan 21 23:17:28 CET 2006 - jayvdb@gmail.com
+
+- lib/backup-files.c: Only create and remove parents that are
+ missing or empty. Report errors in nftw. (Minor changes by
+ agruen@suse.de).
+
+-------------------------------------------------------------------
Sat Jan 21 22:46:23 CET 2006 - jayvdb@gmail.com
- Don't use date -r for comparing file timestamps.