summaryrefslogtreecommitdiff
path: root/src/df.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/df.c')
-rw-r--r--src/df.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/df.c b/src/df.c
index 4f3b56b25..9d956cd03 100644
--- a/src/df.c
+++ b/src/df.c
@@ -1100,10 +1100,19 @@ main (int argc, char **argv)
if (mount_list == NULL)
{
/* Couldn't read the table of mounted file systems.
- Fail if df was invoked with no file name arguments;
- Otherwise, merely give a warning and proceed. */
- int status = (optind < argc ? 0 : EXIT_FAILURE);
- const char *warning = (optind < argc ? _("Warning: ") : "");
+ Fail if df was invoked with no file name arguments,
+ or when either of -a, -l, -t or -x is used with file name
+ arguments. Otherwise, merely give a warning and proceed. */
+ int status = 0;
+ if ( ! (optind < argc)
+ || (show_all_fs
+ || show_local_fs
+ || fs_select_list != NULL
+ || fs_exclude_list != NULL))
+ {
+ status = EXIT_FAILURE;
+ }
+ const char *warning = (status == 0 ? _("Warning: ") : "");
error (status, errno, "%s%s", warning,
_("cannot read table of mounted file systems"));
}