about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2022-10-26 17:16:53 +0200
committerptitSeb <sebastien.chev@gmail.com>2022-10-26 17:16:53 +0200
commited1078dadf692112738d01d19e6e348417485f12 (patch)
tree78e37b540983cb5549615437d61e42eea010f937 /src
parent83dbd728eff99911821021d38c99ac48babb82ba (diff)
downloadbox64-ed1078dadf692112738d01d19e6e348417485f12.tar.gz
box64-ed1078dadf692112738d01d19e6e348417485f12.zip
Try to improve the shell detection, again (for #433)
Diffstat (limited to 'src')
-rwxr-xr-xsrc/tools/fileutils.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/tools/fileutils.c b/src/tools/fileutils.c
index bab4377c..67e8c652 100755
--- a/src/tools/fileutils.c
+++ b/src/tools/fileutils.c
@@ -112,18 +112,15 @@ int FileIsShell(const char* filename)
     if(!f)
         return 0;
     char head[20] = {0};
-    int sz = fread(head, strlen(bashsign), 1, f);
+    int sz = fread(head, strlen(bashsign2), 1, f);
     fclose(f);
     if(sz!=1)
         return 0;
-    head[strlen(bashsign2)] = 0;
-    if(!strcmp(head, bashsign2))
+    if(!strncmp(head, bashsign2, strlen(bashsign2)))
         return 1;
-    head[strlen(bashsign)] = 0;
-    if(!strcmp(head, bashsign))
+    if(!strncmp(head, bashsign, strlen(bashsign)))
         return 1;
-    head[strlen(shsign)] = 0;
-    if(!strcmp(head, shsign))
+    if(!strncmp(head, shsign, strlen(shsign)))
         return 1;
     return 0;
 }