diff options
author | Cameron Katri <me@cameronkatri.com> | 2021-05-13 14:20:43 -0400 |
---|---|---|
committer | Cameron Katri <me@cameronkatri.com> | 2021-05-13 14:20:43 -0400 |
commit | 3b0c74e69809e2daecffe01904d31cfd840270ec (patch) | |
tree | c222db849554a2539b2350f92f601f200e52ed57 | |
parent | 721c6bda7b73ca87d919d3f189fceb669070a13b (diff) | |
download | apple_cmds-3b0c74e69809e2daecffe01904d31cfd840270ec.tar.gz apple_cmds-3b0c74e69809e2daecffe01904d31cfd840270ec.tar.zst apple_cmds-3b0c74e69809e2daecffe01904d31cfd840270ec.zip |
file_cmds: install: Patch strip() to use STRIPBIN env var instead of xcrun
-rw-r--r-- | file_cmds/install/xinstall.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/file_cmds/install/xinstall.c b/file_cmds/install/xinstall.c index 5e6bcec..49934aa 100644 --- a/file_cmds/install/xinstall.c +++ b/file_cmds/install/xinstall.c @@ -721,21 +721,29 @@ void strip(to_name) char *to_name; { + const char *stripbin; + const char *args[3]; pid_t pid; int error; extern char** environ; - char *const argv[] = { "xcrun", "strip", "-", to_name, NULL }; + + stripbin = getenv("STRIPBIN"); + if (stripbin == NULL) + stripbin = "strip"; + args[0] = stripbin; + args[1] = to_name; + args[2] = NULL; - if (0 == (error = posix_spawnp(&pid, "xcrun", NULL, NULL, argv, environ))) { + if (0 == (error = posix_spawnp(&pid, stripbin, NULL, NULL, (char**)args, environ))) { int status = 0; pid_t child = waitpid(pid, &status, 0); if ((child == -1) || status) { unlink(to_name); - errx(EX_SOFTWARE, "child process failed: xcrun strip - %s", to_name); + errx(EX_SOFTWARE, "child process failed: %p", args); } } else { errno = error; - err(EX_OSERR, "xcrun strip - %s", to_name); + err(EX_OSERR, "%p", args); } } |