]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(main): When asking for info on an explicit file name,
authorJim Meyering <jim@meyering.net>
Sat, 15 May 1999 01:53:21 +0000 (01:53 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 15 May 1999 01:53:21 +0000 (01:53 +0000)
just warn rather than failing if the table of mounted filesystems
cannot be read.

src/df.c

index 41b2b647a2dffbcc41b57eef1a121bb3395a119e..c505bb3bf352bea0c0ced80bb18cb880effd3178 100644 (file)
--- a/src/df.c
+++ b/src/df.c
@@ -753,7 +753,15 @@ main (int argc, char **argv)
                           || show_local_fs));
 
   if (mount_list == NULL)
-    error (1, errno, _("cannot read table of mounted filesystems"));
+    {
+      /* Couldn't read the table of mounted filesystems.
+        Fail if df was invoked with no file name arguments;
+        Otherwise, merely give a warning and proceed.  */
+      const char *warning = (optind == argc ? "" : _("Warning: "));
+      int status = (optind == argc ? 1 : 0);
+      error (status, errno,
+            _("%scannot read table of mounted filesystems"), warning);
+    }
 
   if (require_sync)
     sync ();