runtime_loader: remove unnecessary loop

Left behind when we moved from changing only /usr/bin/env to anything
under /usr/bin.

Change-Id: I9ceba844e18deda5f3d395fc6b5df84a1a8ce363
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7360
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Máximo Castañeda 2024-01-29 19:12:26 +01:00 committed by waddlesplash
parent 621200ebbd
commit 3c51bab74e
1 changed files with 4 additions and 11 deletions

View File

@ -374,19 +374,12 @@ open_executable(char *name, image_type type, const char *rpath,
static void
fixup_shebang(char *invoker)
{
char *current = invoker;
while (*current == ' ' || *current == '\t') {
++current;
}
char *commandStart = current;
while (*current != ' ' && *current != '\t' && *current != '\0') {
++current;
}
while (*invoker == ' ' || *invoker == '\t')
++invoker;
// replace /usr/bin/ with /bin/
if (memcmp(commandStart, "/usr/bin/", strlen("/usr/bin/")) == 0)
memmove(commandStart, commandStart + 4, strlen(commandStart + 4) + 1);
if (memcmp(invoker, "/usr/bin/", strlen("/usr/bin/")) == 0)
memmove(invoker, invoker + 4, strlen(invoker + 4) + 1);
}