aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ios-bootstrap/ib-log.h1
-rw-r--r--ios-bootstrap/posixspawn-hook.c26
-rw-r--r--ios-bootstrap/unrestrict.c6
3 files changed, 21 insertions, 12 deletions
diff --git a/ios-bootstrap/ib-log.h b/ios-bootstrap/ib-log.h
index f4b0b35..fee70b5 100644
--- a/ios-bootstrap/ib-log.h
+++ b/ios-bootstrap/ib-log.h
@@ -24,3 +24,4 @@ static void open_logfp_if_necessary() {
fflush(logfp); \
} while(0)
+#define IB_VERBOSE 0
diff --git a/ios-bootstrap/posixspawn-hook.c b/ios-bootstrap/posixspawn-hook.c
index c44f263..80339e1 100644
--- a/ios-bootstrap/posixspawn-hook.c
+++ b/ios-bootstrap/posixspawn-hook.c
@@ -74,12 +74,14 @@ static int hook_posix_spawn_generic(__typeof__(posix_spawn) *old,
short flags;
if (posix_spawnattr_getflags(&my_attr, &flags))
goto crap;
- ib_log("hook_posix_spawn_generic: path=%s%s%s",
- path,
- (flags & POSIX_SPAWN_SETEXEC) ? " (exec)" : "",
- (flags & POSIX_SPAWN_START_SUSPENDED) ? " (suspend)" : "");
- for (char *const *ap = argv; *ap; ap++)
- ib_log(" %s", *ap);
+ if (IB_VERBOSE) {
+ ib_log("hook_posix_spawn_generic: path=%s%s%s",
+ path,
+ (flags & POSIX_SPAWN_SETEXEC) ? " (exec)" : "",
+ (flags & POSIX_SPAWN_START_SUSPENDED) ? " (suspend)" : "");
+ for (char *const *ap = argv; *ap; ap++)
+ ib_log(" %s", *ap);
+ }
/* This mirrors Substrate's logic with safe mode. I don't really
* understand the point of the difference between its 'safe' (which removes
@@ -156,7 +158,8 @@ static int hook_posix_spawn_generic(__typeof__(posix_spawn) *old,
: my_dylib_1;
newp = stpcpy(newp, dylib_to_add);
}
- ib_log("using %s", new);
+ if (IB_VERBOSE)
+ ib_log("using %s", new);
/* no libraries? then just get rid of it */
if (newp == newp_orig) {
free(new);
@@ -205,14 +208,17 @@ static int hook_posix_spawn_generic(__typeof__(posix_spawn) *old,
}
if (fcntl(255, F_SETFD, FD_CLOEXEC))
goto crap;
- ib_log("spawning unrestrict");
+ if (IB_VERBOSE)
+ ib_log("spawning unrestrict");
if (!spawn_unrestrict(getpid(), !was_suspended, true))
goto skip;
}
}
- ib_log("**");
+ if (IB_VERBOSE)
+ ib_log("**");
int ret = old(pidp, path, file_actions, &my_attr, argv, envp_to_use);
- ib_log("ret=%d pid=%ld", ret, (long) *pidp);
+ if (IB_VERBOSE)
+ ib_log("ret=%d pid=%ld", ret, (long) *pidp);
if (ret)
goto cleanup;
/* Since it returned, obviously it was not SETEXEC, so we need to
diff --git a/ios-bootstrap/unrestrict.c b/ios-bootstrap/unrestrict.c
index 11988b1..3c6ff56 100644
--- a/ios-bootstrap/unrestrict.c
+++ b/ios-bootstrap/unrestrict.c
@@ -47,8 +47,10 @@ int main(int argc, char **argv) {
return 0;
}
- ib_log("unrestrict: unrestricting %ld (sr=%s, ie=%s)", pid,
- should_resume, is_exec);
+ if (IB_VERBOSE) {
+ ib_log("unrestrict: unrestricting %ld (sr=%s, ie=%s)", pid,
+ should_resume, is_exec);
+ }
int ec = 1;