mcexec shebang: delete spaces *before* path as well
Apparently, a shebang '#! /bin/sh' should work. Will add some ostests for these... Change-Id: Iab8ba8e3cc7e434c98742f71fe7db3c425f08278
This commit is contained in:
committed by
Dominique Martinet
parent
527adedaa3
commit
1253f4d18c
@@ -667,13 +667,18 @@ int load_elf_desc(char *filename, struct program_load_desc **desc_p,
|
||||
|
||||
fclose(fp);
|
||||
|
||||
/* Delete new line character and any trailing spaces */
|
||||
/* Delete new line character and any trailing/leading spaces */
|
||||
shebang_len = strlen(shebang) - 1;
|
||||
shebang[shebang_len] = '\0';
|
||||
while (strpbrk(shebang + shebang_len - 1, " \t")) {
|
||||
while (shebang_len > 0 &&
|
||||
strpbrk(shebang + shebang_len - 1, " \t")) {
|
||||
shebang_len--;
|
||||
shebang[shebang_len] = '\0';
|
||||
}
|
||||
while (shebang_len > 0 && strpbrk(shebang, " \t") == shebang) {
|
||||
shebang_len--;
|
||||
shebang++;
|
||||
}
|
||||
*shebang_p = shebang;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user