]> err.no Git - systemd/commitdiff
vol_id: make the --offset= argument optional
authorKay Sievers <kay.sievers@vrfy.org>
Fri, 22 Aug 2008 08:04:55 +0000 (10:04 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Fri, 22 Aug 2008 08:04:55 +0000 (10:04 +0200)
extras/cdrom_id/cdrom_id.c
extras/volume_id/vol_id.c

index acf7a97e416d067a85c978c114ffa9444a0a810d..9e274718631e38ac0b431ede4578be792fbac1b4 100644 (file)
@@ -693,11 +693,11 @@ print:
                printf("ID_CDROM_MEDIA_SESSION_COUNT=%d\n", cd_media_session_count);
        if (cd_media_track_count > 0)
                printf("ID_CDROM_MEDIA_TRACK_COUNT=%d\n", cd_media_track_count);
-       if (cd_media_track_count_audio)
+       if (cd_media_track_count_audio > 0)
                printf("ID_CDROM_MEDIA_TRACK_COUNT_AUDIO=%d\n", cd_media_track_count_audio);
-       if (cd_media_track_count_data)
+       if (cd_media_track_count_data > 0)
                printf("ID_CDROM_MEDIA_TRACK_COUNT_DATA=%d\n", cd_media_track_count_data);
-       if (cd_media_session_last_offset)
+       if (cd_media_session_last_offset > 0)
                printf("ID_CDROM_MEDIA_SESSION_LAST_OFFSET=%llu\n", cd_media_session_last_offset);
 exit:
        if (fd >= 0)
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"