]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blobdiff - quota/init.c
xfs_quota: certain commands must always be available
[thirdparty/xfsprogs-dev.git] / quota / init.c
index 137cd6852eeb08d5c1a805b6ef1ce588502b0ad9..44be3222bd992f5ed11f8a100b6da8ce2a6b520e 100644 (file)
@@ -109,15 +109,26 @@ static int
 init_check_command(
        const cmdinfo_t *ct)
 {
-       if (fs_path &&
-           !(ct->flags & CMD_FLAG_FOREIGN_OK) &&
-            (fs_path->fs_flags & FS_FOREIGN)) {
-               fprintf(stderr,
-       _("foreign mount active, %s command is for XFS filesystems only\n"),
-                       ct->name);
-               return 0;
-       }
-       return 1;
+       if (!fs_path)
+               return 1;
+
+       /* Always run commands that we are told to skip here */
+       if (ct->flags & CMD_ALL_FSTYPES)
+               return 1;
+
+       /* if it's an XFS filesystem, always run the command */
+       if (!(fs_path->fs_flags & FS_FOREIGN))
+               return 1;
+
+       /* If the user specified foreign filesysetms are ok, run it */
+       if (foreign_allowed &&
+           (ct->flags & CMD_FLAG_FOREIGN_OK))
+               return 1;
+
+       /* foreign filesystem and it's not a valid command! */
+       fprintf(stderr, _("%s command is for XFS filesystems only\n"),
+               ct->name);
+       return 0;
 }
 
 static void