]> glassweightruler.freedombox.rocks Git - Ventoy.git/commitdiff
Fix the boot issue for Fedora/CentOS when file name contains special character (e...
authorlongpanda <admin@ventoy.net>
Fri, 21 Apr 2023 12:05:30 +0000 (20:05 +0800)
committerlongpanda <admin@ventoy.net>
Fri, 21 Apr 2023 12:05:30 +0000 (20:05 +0800)
IMG/cpio/ventoy/hook/rhel7/ventoy-hook.sh
VtoyTool/vtoydump.c
VtoyTool/vtoytool/00/vtoytool_32
VtoyTool/vtoytool/00/vtoytool_64
VtoyTool/vtoytool/00/vtoytool_aa64
VtoyTool/vtoytool/00/vtoytool_m64e

index 852e4136082b6ecf68ca432af9c23c3b52aa111a..613fa767d2fc93f28279778778c956e7931530d2 100644 (file)
@@ -125,6 +125,7 @@ fi
 
 #iso-scan (currently only for Fedora)
 if $GREP -q Fedora /etc/os-release; then
+if /ventoy/tool/vtoydump -a /ventoy/ventoy_os_param; then
     if ventoy_iso_scan_check; then
         echo "iso_scan process ..." >> $VTLOG
         
@@ -139,6 +140,7 @@ if $GREP -q Fedora /etc/os-release; then
 
         exit 0
     fi
+fi    
 fi
 
 
index c090b7e68f27c267cbbfda26172c1e78a8445234..25c288b0bd089ffa4ccb5539c1ba398fc18b3c99 100644 (file)
@@ -22,6 +22,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
+#include <ctype.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/types.h>
@@ -444,6 +445,29 @@ static int vtoy_vlnk_printf(ventoy_os_param *param, char *diskname)
     return 1;
 }
 
+static int vtoy_check_iso_path_alpnum(ventoy_os_param *param)
+{
+    char c;
+    int i = 0;
+    
+    while (param->vtoy_img_path[i])
+    {
+        c = param->vtoy_img_path[i]; 
+        
+        if (isalnum(c) || c == '_' || c == '-')
+        {
+            
+        }
+        else
+        {
+            return 1;
+        }
+        i++;
+    }
+
+    return 0;
+}
+
 static int vtoy_check_device(ventoy_os_param *param, const char *device)
 {
     unsigned long long size; 
@@ -560,6 +584,7 @@ int vtoydump_main(int argc, char **argv)
     int rc;
     int ch;
     int print_path = 0;
+    int check_ascii = 0;
     int print_fs = 0;
     int vlnk_print = 0;
     char filename[256] = {0};
@@ -567,7 +592,7 @@ int vtoydump_main(int argc, char **argv)
     char device[64] = {0};
     ventoy_os_param *param = NULL;
 
-    while ((ch = getopt(argc, argv, "c:f:p:t:s:v::")) != -1)
+    while ((ch = getopt(argc, argv, "a:c:f:p:t:s:v::")) != -1)
     {
         if (ch == 'f')
         {
@@ -586,6 +611,11 @@ int vtoydump_main(int argc, char **argv)
             print_path = 1;
             strncpy(filename, optarg, sizeof(filename) - 1);
         }
+        else if (ch == 'a')
+        {
+            check_ascii = 1;
+            strncpy(filename, optarg, sizeof(filename) - 1);
+        }
         else if (ch == 't')
         {
             vlnk_print = 1;
@@ -660,6 +690,10 @@ int vtoydump_main(int argc, char **argv)
     {
         rc = vtoy_check_device(param, device);
     }
+    else if (check_ascii)
+    {
+        rc = vtoy_check_iso_path_alpnum(param);
+    }
     else
     {
         // print os param, you can change the output format in the function
index 18fbb9d5e185318d0c90c35e7ae0154a51d98bd3..556f11bd494e3c20fe99430b6cded53a9e8b967a 100644 (file)
Binary files a/VtoyTool/vtoytool/00/vtoytool_32 and b/VtoyTool/vtoytool/00/vtoytool_32 differ
index c735633690aeb1a85ddf37060b1857e26c59f5bb..45edfacd02d89b0443c90a4ea3343d41674d3b3e 100644 (file)
Binary files a/VtoyTool/vtoytool/00/vtoytool_64 and b/VtoyTool/vtoytool/00/vtoytool_64 differ
index afd8c5a57e808141aad7b7cf17dfbcf30aea9b03..2546cb936de4faceaf0c7eef5ba5faea8c93a7ac 100644 (file)
Binary files a/VtoyTool/vtoytool/00/vtoytool_aa64 and b/VtoyTool/vtoytool/00/vtoytool_aa64 differ
index 39e3534c033a1ed6cfe7cf418f72fb548b9a3c67..6a1283eeff3e5ae2a379a70960ae790a7effa98d 100644 (file)
Binary files a/VtoyTool/vtoytool/00/vtoytool_m64e and b/VtoyTool/vtoytool/00/vtoytool_m64e differ