From: Kay Sievers Date: Fri, 22 Aug 2008 08:04:55 +0000 (+0200) Subject: vol_id: make the --offset= argument optional X-Git-Tag: 174~1626 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f46a8a98a79afcbb9e9910d7d71c1f8ef4e6637f;p=systemd vol_id: make the --offset= argument optional --- diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index acf7a97e..9e274718 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -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) diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 60428ab5..b3f810fc 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -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] \n"