- if (response == NULL) {
- fprintf(stderr, "launch_msg() == NULL\n");
- return 4;
- }
+ pid_t pid;
+
+ if (launch_data_get_type(response) == LAUNCH_DATA_ERRNO) {
+ int error = launch_data_get_errno(response);
+ _assert(error == ESRCH, "GetJob(%s): %s", label, strerror(error));
+ pid = -1;
+ } else if (launch_data_get_type(response) == LAUNCH_DATA_DICTIONARY) {
+ data = launch_data_dict_lookup(response, LAUNCH_JOBKEY_PID);
+ _assert(data != NULL, "launch_data_dict_lookup(PID) == NULL");
+ pid = launch_data_get_integer(data);
+ } else _assert(false, "launch_data_get_type() not in (DICTIONARY, ERRNO)");
+
+ launch_data_free(response);
+
+ fprintf(stderr, "notify_post(com.apple.mobile.springboard_teardown)\n");
+ notify_post("com.apple.mobile.springboard_teardown");