aboutsummaryrefslogtreecommitdiff
path: root/darwin-bootstrap/posixspawn-hook.c
diff options
context:
space:
mode:
authorcomex2015-07-11 14:52:03 -0400
committercomex2015-07-11 14:52:03 -0400
commit324d1437fbe6a9daf11137b00f9b1efd9df7399f (patch)
treee3b2cf9228a4f66b183b0572c08780b96edb8ede /darwin-bootstrap/posixspawn-hook.c
parentbetter fix (diff)
downloadsubstitute-324d1437fbe6a9daf11137b00f9b1efd9df7399f.tar.gz
be safe in case the dylibs are missing
Diffstat (limited to 'darwin-bootstrap/posixspawn-hook.c')
-rw-r--r--darwin-bootstrap/posixspawn-hook.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/darwin-bootstrap/posixspawn-hook.c b/darwin-bootstrap/posixspawn-hook.c
index 03d063c..4920d0a 100644
--- a/darwin-bootstrap/posixspawn-hook.c
+++ b/darwin-bootstrap/posixspawn-hook.c
@@ -224,6 +224,13 @@ static int hook_posix_spawn_generic(__typeof__(posix_spawn) *old,
dylib_to_add = bl_dylib;
}
+ if (access(dylib_to_add, R_OK)) {
+ /* Substitute must have been uninstalled or something. In the future
+ * we'll be able to actually unload from launchd, but this is still
+ * useful as a safety measure. */
+ goto skip;
+ }
+
if (attrp) {
posix_spawnattr_t attr = *attrp;
size_t size = malloc_size(attr);