diff options
Diffstat (limited to 'util-linux/volume_id/get_devname.c')
-rw-r--r-- | util-linux/volume_id/get_devname.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/util-linux/volume_id/get_devname.c b/util-linux/volume_id/get_devname.c index bb3043cd6..b46aad4a2 100644 --- a/util-linux/volume_id/get_devname.c +++ b/util-linux/volume_id/get_devname.c | |||
@@ -243,8 +243,8 @@ dev_get_major_minor(char *device_name, int *major, int *minor) | |||
243 | colon = strchr(dev, ':'); | 243 | colon = strchr(dev, ':'); |
244 | if (!colon) | 244 | if (!colon) |
245 | goto ret; | 245 | goto ret; |
246 | *major = strtol(dev, NULL, 10); | 246 | *major = bb_strtou(dev, NULL, 10); |
247 | *minor = strtol(colon + 1, NULL, 10); | 247 | *minor = bb_strtou(colon + 1, NULL, 10); |
248 | 248 | ||
249 | ret: | 249 | ret: |
250 | free(dev_path); | 250 | free(dev_path); |
@@ -261,27 +261,28 @@ uuidcache_init_cdroms(void) | |||
261 | 261 | ||
262 | proccd = fopen(PROC_CDROMS, "r"); | 262 | proccd = fopen(PROC_CDROMS, "r"); |
263 | if (!proccd) { | 263 | if (!proccd) { |
264 | static smallint warn = 0; | 264 | // static smallint warn = 0; |
265 | if (!warn) { | 265 | // if (!warn) { |
266 | warn = 1; | 266 | // warn = 1; |
267 | bb_error_msg("mount: could not open %s, so UUID and LABEL " | 267 | // bb_error_msg("can't open %s, UUID and LABEL " |
268 | "conversion cannot be done for CD-Roms.", | 268 | // "conversion cannot be done for CD-Roms", |
269 | PROC_CDROMS); | 269 | // PROC_CDROMS); |
270 | } | 270 | // } |
271 | return; | 271 | return; |
272 | } | 272 | } |
273 | 273 | ||
274 | while (fgets(line, sizeof(line), proccd)) { | 274 | while (fgets(line, sizeof(line), proccd)) { |
275 | static const char drive_name_string[] ALIGN1 = "drive name:\t\t"; | 275 | static const char drive_name_string[] ALIGN1 = "drive name:"; |
276 | 276 | ||
277 | if (strncmp(line, drive_name_string, sizeof(drive_name_string) - 1) == 0) { | 277 | if (strncmp(line, drive_name_string, sizeof(drive_name_string) - 1) == 0) { |
278 | char *device_name; | 278 | char *device_name; |
279 | device_name = strtok(line + sizeof(drive_name_string) - 1, "\t\n"); | 279 | |
280 | while (device_name) { | 280 | device_name = strtok(skip_whitespace(line + sizeof(drive_name_string) - 1), " \t\n"); |
281 | while (device_name && device_name[0]) { | ||
281 | ma = mi = -1; | 282 | ma = mi = -1; |
282 | dev_get_major_minor(device_name, &ma, &mi); | 283 | dev_get_major_minor(device_name, &ma, &mi); |
283 | uuidcache_check_device(device_name, ma, mi, 1); | 284 | uuidcache_check_device(device_name, ma, mi, 1); |
284 | device_name = strtok(NULL, "\t\n"); | 285 | device_name = strtok(NULL, " \t\n"); |
285 | } | 286 | } |
286 | break; | 287 | break; |
287 | } | 288 | } |
@@ -418,7 +419,8 @@ char *get_devname_from_uuid(const char *spec) | |||
418 | uuidcache_init(); | 419 | uuidcache_init(); |
419 | uc = uuidCache; | 420 | uc = uuidCache; |
420 | while (uc) { | 421 | while (uc) { |
421 | if (strcmp(spec, uc->uc_uuid) == 0) { | 422 | /* case of hex numbers doesn't matter */ |
423 | if (strcasecmp(spec, uc->uc_uuid) == 0) { | ||
422 | return xstrdup(uc->device); | 424 | return xstrdup(uc->device); |
423 | } | 425 | } |
424 | uc = uc->next; | 426 | uc = uc->next; |