objective c - Cannot invalidate launchd kextcache from helper executable -
i've built uninstaller call helper executable elevated permissions remove driver's launchd-plist, won't come again on next boot cycle.
in order reflect new stage of /library/launchdaemons
, invalidate kextcache using following command touch /library/extensions/
showed in question.
however, when helper executable right after plist file removed, wouldn't succeed, , driver still go after reboot. when manually typing command touch /library/extensions
right after uninstaller helper finish, trick.
here's how code looks in first option (invalidate helper exec).
remove(osx_launchd_plist_path); pid_t pid = -1; char const * args[] = {"touch", "/library/extensions", null}; posix_spawn(&pid, "/usr/bin/touch", null, null, (char **)args, null); waitpid(pid, &status, wnohang|wuntraced);
perhaps tell me why different behaviour in each of options.
update:
it seems cache invalidation requires repeat command more once. code worked me, don't have clue why ...
(int x=0 ; x < 2; x++ ) { char const * args[] = {"touch", "/library/extensions", null}; posix_spawn(&pid, "/usr/bin/touch", null, null, (char **)args, null); waitpid(pid, &status, wnohang|wuntraced); char const * args2[] = {"touch", "/system/library/extensions", null}; posix_spawn(&pid, "/usr/bin/touch", null, null, (char **)args2, null); waitpid(pid, &status, wnohang|wuntraced); }
Comments
Post a Comment