diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2022-10-10 23:30:51 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2022-10-10 23:30:51 +0200 |
| commit | f2b8b06280fb4a88509f014e35f610e458632f66 (patch) | |
| tree | 0837cb3b7ad3d169d7e442e7bae044d67de4f565 /src/tools | |
| parent | 0cc04e5253aa31544ca9e234b37e20b1ab81232f (diff) | |
| download | box64-f2b8b06280fb4a88509f014e35f610e458632f66.tar.gz box64-f2b8b06280fb4a88509f014e35f610e458632f66.zip | |
Fixed and improved Shell script detection
Diffstat (limited to 'src/tools')
| -rwxr-xr-x | src/tools/fileutils.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/tools/fileutils.c b/src/tools/fileutils.c index 42524ee8..c9765740 100755 --- a/src/tools/fileutils.c +++ b/src/tools/fileutils.c @@ -19,6 +19,7 @@ static const char* x86lib = "\x7f" "ELF" "\x01" "\x01" "\x01" "\x03" "\x00" "\x static const char* x64lib = "\x7f" "ELF" "\x02" "\x01" "\x01" "\x03" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x00" "\x02" "\x00" "\x3e" "\x00"; static const char* bashsign= "#!/bin/bash"; static const char* shsign = "#!/bin/sh"; +static const char* bashsign2="#!/usr/bin/env bash"; int FileExist(const char* filename, int flags) { @@ -109,10 +110,13 @@ int FileIsShell(const char* filename) fclose(f); if(sz!=1) return 0; - head[strlen(bashsign)+1] = 0; + head[strlen(bashsign2)] = 0; + if(!strcmp(head, bashsign2)) + return 1; + head[strlen(bashsign)] = 0; if(!strcmp(head, bashsign)) return 1; - head[strlen(shsign)+1] = 0; + head[strlen(shsign)] = 0; if(!strcmp(head, shsign)) return 1; return 0; |