]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_io: Disable -V if pwritev is not available
authorGoldwyn Rodrigues <rgoldwyn@suse.com>
Thu, 9 Nov 2017 20:54:59 +0000 (14:54 -0600)
committerEric Sandeen <sandeen@redhat.com>
Thu, 9 Nov 2017 20:54:59 +0000 (14:54 -0600)
This results in default case which will display the error message
that command is not found. This is required for xfs_io builds which
did not support pwritev and an attempt is made to use -V.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
[sandeen@sandeen.net: restrict default: printf to ifdef'd options]
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
io/pwrite.c

index 71bccccfd6b04febe547a7f3d579c0a142da63a2..8af607effba70954372c68793befafe98127bcff 100644 (file)
@@ -312,6 +312,7 @@ pwrite_f(
                case 'u':
                        uflag = 1;
                        break;
+#ifdef HAVE_PWRITEV
                case 'V':
                        vectors = strtoul(optarg, &sp, 0);
                        if (!sp || sp == optarg) {
@@ -320,6 +321,7 @@ pwrite_f(
                                return 0;
                        }
                        break;
+#endif
                case 'w':
                        wflag = 1;
                        break;
@@ -334,7 +336,12 @@ pwrite_f(
                        }
                        break;
                default:
-                       return command_usage(&pwrite_cmd);
+                       /* Handle ifdef'd-out options above */
+                       if (c != '?')
+                               printf(_("%s: command -%c not supported\n"), argv[0], c);
+                       else
+                               command_usage(&pwrite_cmd);
+                       return 0;
                }
        }
        if (((skip || dflag) && !infile) || (optind != argc - 2))