X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/Ventoy.git/blobdiff_plain/43e8ec57857e3786b40eb4208729e9fcf9826000..05137c83e2d0da4ea5dbf6eb7866f4adb6478e9d:/LinuxGUI/Ventoy2Disk/Core/ventoy_disk.c diff --git a/LinuxGUI/Ventoy2Disk/Core/ventoy_disk.c b/LinuxGUI/Ventoy2Disk/Core/ventoy_disk.c index 4d0871b..04eb7f4 100644 --- a/LinuxGUI/Ventoy2Disk/Core/ventoy_disk.c +++ b/LinuxGUI/Ventoy2Disk/Core/ventoy_disk.c @@ -232,6 +232,12 @@ static int ventoy_is_possible_blkdev(const char *name) { return 0; } + + /* /dev/zramX */ + if (name[0] == 'z' && name[1] == 'r' && name[2] == 'a' && name[3] == 'm') + { + return 0; + } /* /dev/loopX */ if (name[0] == 'l' && name[1] == 'o' && name[2] == 'o' && name[3] == 'p') @@ -330,6 +336,7 @@ static int fatlib_is_secure_boot_enable(void) flfile = fl_fopen("/EFI/BOOT/grubx64_real.efi", "rb"); if (flfile) { + vlog("/EFI/BOOT/grubx64_real.efi find, secure boot in enabled\n"); fl_fclose(flfile); return 1; } @@ -504,7 +511,12 @@ int ventoy_get_vtoy_data(ventoy_disk *info, int *ppartstyle) goto end; } - vdebug("now check secure boot ...\n"); + vdebug("ventoy partition layout check OK: [%llu %llu] [%llu %llu]\n", + part1_start_sector, part1_sector_count, part2_start_sector, part2_sector_count); + + vtoy->ventoy_valid = 1; + + vdebug("now check secure boot for %s ...\n", info->disk_path); g_fatlib_media_fd = fd; g_fatlib_media_offset = part2_start_sector; @@ -516,7 +528,6 @@ int ventoy_get_vtoy_data(ventoy_disk *info, int *ppartstyle) if (ret == 0 && vtoy->ventoy_ver[0]) { vtoy->secure_boot_flag = fatlib_is_secure_boot_enable(); - vtoy->ventoy_valid = 1; } else { @@ -532,6 +543,11 @@ int ventoy_get_vtoy_data(ventoy_disk *info, int *ppartstyle) g_fatlib_media_fd = -1; g_fatlib_media_offset = 0; + if (vtoy->ventoy_ver[0] == 0) + { + vtoy->ventoy_ver[0] = '?'; + } + if (0 == vtoy->ventoy_valid) { goto end; @@ -546,7 +562,7 @@ int ventoy_get_vtoy_data(ventoy_disk *info, int *ppartstyle) rc = 0; end: - close(fd); + vtoy_safe_close_fd(fd); return rc; }