From 4ab17bc29f65d1259559c7cf60a0f3ace2e7bb56 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Tue, 27 Dec 2011 00:42:39 +0000 Subject: [PATCH] Attempt to fix sbreload on 5.x. --- sbreload.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/sbreload.c b/sbreload.c index dc669d5..20a7da9 100644 --- a/sbreload.c +++ b/sbreload.c @@ -121,10 +121,12 @@ void stop() { sleep(1); } +#define SpringBoard_plist "/System/Library/LaunchDaemons/com.apple.SpringBoard.plist" + int main(int argc, const char *argv[]) { _assert(argc == 1, "usage: sbreload"); - CFDictionaryRef plist = CreateMyPropertyListFromFile("/System/Library/LaunchDaemons/com.apple.SpringBoard.plist"); + CFDictionaryRef plist = CreateMyPropertyListFromFile(SpringBoard_plist); _assert(plist != NULL, "CreateMyPropertyListFromFile() == NULL"); launch_data_t job = CF2launch_data(plist); @@ -157,8 +159,18 @@ int main(int argc, const char *argv[]) { launch_data_free(response); - fprintf(stderr, "notify_post(com.apple.mobile.springboard_teardown)\n"); - notify_post("com.apple.mobile.springboard_teardown"); + // 600 is being used to approximate 4.x/5.x boundary + if (kCFCoreFoundationVersionNumber < 600) { + fprintf(stderr, "notify_post(com.apple.mobile.springboard_teardown)\n"); + notify_post("com.apple.mobile.springboard_teardown"); + } else { + // XXX: this code is preferable to launchctl unoad but it requires libvproc? :( + //vproc_err_t *error = _vproc_send_signal_by_label(label, VPROC_MAGIC_UNLOAD_SIGNAL); + //_assert(error == NULL, "_vproc_send_signal_by_label(UNLOAD) != NULL"); + + fprintf(stderr, "launchctl unload SpringBoard.plist\n"); + system("launchctl unload " SpringBoard_plist); + } if (pid != -1) { fprintf(stderr, "waiting for kill(%u) != 0...\n", pid); -- 2.45.2