#include <utmpx.h>
#include <vproc_priv.h>
#include <asl_private.h>
+#include <pwd.h>
+
#if !TARGET_OS_IPHONE
#include <quarantine.h>
#endif
main(int argc, const char *argv[])
{
int32_t i;
+ uint64_t master_val;
#if !TARGET_IPHONE_SIMULATOR
int network_change_token;
#endif
- int quota_file_token, asl_db_token;
+ int quota_file_token, asl_db_token, master_token;
char tstr[32], *notify_key;
time_t now;
int first_syslogd_start = 1;
* guilty of this in the past, creating them with owner root.
*/
- asl_secure_chown_chmod_dir("/private/var/mobile/Library/Logs", 501, 501, 0755);
- asl_secure_chown_chmod_dir("/private/var/mobile/Library/Logs/CrashReporter", 501, 501, 0755);
- asl_secure_chown_chmod_dir("/private/var/mobile/Library/Logs/CrashReporter/DiagnosticLogs", 501, 501, 0755);
+ uid_t __mUserUID = 501;
+ gid_t __mUserGID = 501;
+ struct passwd * pw = getpwnam("mobile");
+
+ if (pw) {
+ __mUserUID = pw->pw_uid;
+ __mUserGID = pw->pw_gid;
+ }
+
+ asl_secure_chown_chmod_dir("/private/var/mobile/Library/Logs", __mUserUID, __mUserGID, 0755);
+ asl_secure_chown_chmod_dir("/private/var/mobile/Library/Logs/CrashReporter", __mUserUID, __mUserGID, 0755);
+ asl_secure_chown_chmod_dir("/private/var/mobile/Library/Logs/CrashReporter/DiagnosticLogs", __mUserUID, __mUserGID, 0755);
#endif
/* Set I/O policy */
*/
write_boot_log(first_syslogd_start);
+ /* default NOTIFY_SYSTEM_MASTER settings */
+ master_val = 0x0;
+ notify_register_plain(NOTIFY_SYSTEM_MASTER, &master_token);
+ notify_set_state(master_token, master_val);
+
asldebug("reading launch plist\n");
launch_config();