diff options
-rw-r--r-- | darwin-bootstrap/bundle-loader.c | 2 | ||||
-rw-r--r-- | darwin-bootstrap/posixspawn-hook.c | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/darwin-bootstrap/bundle-loader.c b/darwin-bootstrap/bundle-loader.c index 754bd5c..b3c60d5 100644 --- a/darwin-bootstrap/bundle-loader.c +++ b/darwin-bootstrap/bundle-loader.c @@ -227,6 +227,8 @@ static void init() { return; } const char *argv0 = (*_NSGetArgv())[0]; + if (!argv0) + argv0 = "???"; void *bundle_list; size_t bundle_list_size; kr = substituted_hello(service, SUBSTITUTED_PROTO_VERSION, argv0, diff --git a/darwin-bootstrap/posixspawn-hook.c b/darwin-bootstrap/posixspawn-hook.c index ee6a1cb..d2a79f4 100644 --- a/darwin-bootstrap/posixspawn-hook.c +++ b/darwin-bootstrap/posixspawn-hook.c @@ -241,14 +241,15 @@ static int hook_posix_spawn_generic(__typeof__(posix_spawn) *old, /* append if it isn't one of ours */ bool is_substitute = (next - p == sizeof(bl_dylib) - 1 && - !memcmp(next, bl_dylib, sizeof(bl_dylib) - 1)) || + !memcmp(p, bl_dylib, sizeof(bl_dylib) - 1)) || (next - p == sizeof(psh_dylib) - 1 && - !memcmp(next, psh_dylib, sizeof(psh_dylib) - 1)); + !memcmp(p, psh_dylib, sizeof(psh_dylib) - 1)); if (!is_substitute) { if (newp != newp_orig) *newp++ = ':'; memcpy(newp, p, next - p); newp += next - p; + *newp = '\0'; } if (!*next) break; |