chiark / gitweb /
vol_id: make the --offset= argument optional
[elogind.git] / extras / volume_id / vol_id.c
index 60428ab5821a4417c10a6dd8f7947699ad698b85..b3f810fc9d3d6082af10e4ad8e1a132fcc44c617 100644 (file)
@@ -134,7 +134,7 @@ int main(int argc, char *argv[])
                { "export", 0, NULL, 'x' },
                { "skip-raid", 0, NULL, 's' },
                { "probe-all", 0, NULL, 'a' },
-               { "offset", 1, NULL, 'o' },
+               { "offset", 2, NULL, 'o' },
                { "help", 0, NULL, 'h' },
                {}
        };
@@ -196,7 +196,8 @@ int main(int argc, char *argv[])
                        probe_all = 1;
                        break;
                case 'o':
-                       offset = strtoull(optarg, NULL, 0);
+                       if (optarg[0] != '\0')
+                               offset = strtoull(optarg, NULL, 0);
                        break;
                case 'h':
                        printf("Usage: vol_id [options] <device>\n"