| 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 1162ed831bb902d4d2bbf40477cc61b250f9ea8f..dae4bce9111697448aeae458b9e5efc3b140ddc8 100644
|
| --- a/src/platform/vboot_reference/utility/cgpt/cgpt_options.c
|
| +++ b/src/platform/vboot_reference/utility/cgpt/cgpt_options.c
|
| @@ -107,8 +107,17 @@ int OpenDriveInLastArgument(const int argc,
|
| struct drive *drive) {
|
| /* Then, we need a non-option argument. */
|
| if (optind == (argc - 1)) {
|
| - char *drive_path;
|
| - drive_path = argv[optind];
|
| + 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;
|
|
|