]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
rmdir: give better diagnostics
authorJim Meyering <jim@meyering.net>
Wed, 13 Jun 2007 13:53:12 +0000 (15:53 +0200)
committerJim Meyering <jim@meyering.net>
Wed, 13 Jun 2007 13:53:12 +0000 (15:53 +0200)
* src/rmdir.c (remove_parents): Give a more descriptive/consistent
diagnostic upon failure.
(main): Likewise.
Suggestion from Joey Hess.
* THANKS: Add Joey Hess.

ChangeLog
THANKS
src/rmdir.c

index f48ffddb93a89a610ac54ffee4549d1efa1b9439..92a840884a4cf60857b2400b0104ba98676f1371 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2007-06-13  Jim Meyering  <jim@meyering.net>
 
+       rmdir: give better diagnostics
+       * src/rmdir.c (remove_parents): Give a more descriptive/consistent
+       diagnostic upon failure.
+       (main): Likewise.
+       Suggestion from Joey Hess.
+       * THANKS: Add Joey Hess.
+
        Don't include "quotearg.h" when it is not used.
        * Makefile.maint (sc_prohibit_quotearg_without_use): New rule.
        * src/cp.c: Don't include "quotearg.h".  It wasn't used.
diff --git a/THANKS b/THANKS
index e35b9fd5e075c40830cfad64ef51531a39d8f44e..c86dab72efce8dfef96fc0d0ca50ae39da4aa08c 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -239,6 +239,7 @@ Joakim Rosqvist                     dvljrt@cs.umu.se
 Jochen Hein                         jochen@jochen.org
 Joe Orton                           joe@manyfish.co.uk
 Joerg Sonnenberger                  joerg@britannica.bec.de
+Joey Hess                           joeyh@debian.org
 Johan Boule                         bohan@bohan.dyndns.org
 Johan Danielsson                    joda@pdc.kth.se
 John Bley                           jbb6@acpub.duke.edu
index 5dd5a35a6ea1bc024285b568bb02b28b6154df98..ca1af0e4c963f651c20a1f1a422f6e16dc1eb68d 100644 (file)
@@ -1,6 +1,6 @@
 /* rmdir -- remove directories
 
-   Copyright (C) 90, 91, 1995-2002, 2004, 2005, 2006 Free Software
+   Copyright (C) 90, 91, 1995-2002, 2004, 2005, 2006, 2007 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -31,7 +31,7 @@
 
 #include "system.h"
 #include "error.h"
-#include "quotearg.h"
+#include "quote.h"
 
 /* The official name of this program (e.g., no `g' prefix).  */
 #define PROGRAM_NAME "rmdir"
@@ -107,7 +107,7 @@ remove_parents (char *dir)
 
       /* Give a diagnostic for each attempted removal if --verbose.  */
       if (verbose)
-       error (0, 0, _("removing directory, %s"), dir);
+       error (0, 0, _("removing directory, %s"), quote (dir));
 
       ok = (rmdir (dir) == 0);
 
@@ -121,7 +121,9 @@ remove_parents (char *dir)
            }
          else
            {
-             error (0, errno, "%s", quotearg_colon (dir));
+             /* Barring race conditions, DIR is expected to be a directory.  */
+             error (0, errno, _("failed to remove directory %s"),
+                    quote (dir));
            }
          break;
        }
@@ -213,7 +215,9 @@ main (int argc, char **argv)
              && errno_rmdir_non_empty (errno))
            continue;
 
-         error (0, errno, "%s", quotearg_colon (dir));
+         /* Here, the diagnostic is less precise, since we have no idea
+            whether DIR is a directory.  */
+         error (0, errno, _("failed to remove %s"), quote (dir));
          ok = false;
        }
       else if (remove_empty_parents)