Index: src/platform/vboot_reference/utility/cgpt/cgpt_options.c |
diff --git a/src/platform/vboot_reference/utility/cgpt/cgpt_options.c b/src/platform/vboot_reference/utility/cgpt/cgpt_options.c |
index c119ac9f49a8bebf16de39efb1172f6a0a869f4c..b434eeaf3650325f2553cf6221e1f0546d0646ab 100644 |
--- a/src/platform/vboot_reference/utility/cgpt/cgpt_options.c |
+++ b/src/platform/vboot_reference/utility/cgpt/cgpt_options.c |
@@ -125,27 +125,10 @@ int HandleOptions(const int argc, |
int OpenDriveInLastArgument(const int argc, |
char *const *argv, |
struct drive *drive) { |
- /* Then, we need a non-option argument. */ |
- if (optind == (argc - 1)) { |
- char *path, drive_path[256]; |
- path = argv[optind]; |
- switch (path[0]) { |
- case '.': |
- case '/': |
- snprintf(drive_path, sizeof(drive_path), "%s", path); |
- break; |
- default: |
- snprintf(drive_path, sizeof(drive_path), "/dev/%s", path); |
- break; |
- } |
- if (CGPT_OK != DriveOpen(drive_path, drive)) { |
- printf("[ERROR] DriveOpen(%s) error!\n", drive_path); |
- return CGPT_FAILED; |
- } |
- } else { |
+ if (optind != (argc - 1)) { |
printf("[ERROR] One (and only one) non-option argument is required.\n"); |
return CGPT_FAILED; |
} |
- return CGPT_OK; |
+ return DriveOpen(argv[optind], drive); |
} |