Revision: 23310 http://trac.macosforge.org/projects/launchd/changeset/23310 Author: zarzycki@apple.com Date: 2007-07-16 08:47:31 -0700 (Mon, 16 Jul 2007) Log Message: ----------- clarity++ Modified Paths: -------------- trunk/launchd/src/launchd_core_logic.c Modified: trunk/launchd/src/launchd_core_logic.c =================================================================== --- trunk/launchd/src/launchd_core_logic.c 2007-07-12 23:00:49 UTC (rev 23309) +++ trunk/launchd/src/launchd_core_logic.c 2007-07-16 15:47:31 UTC (rev 23310) @@ -2607,6 +2607,17 @@ return; } + /* + * We must copy the results of getpw*(). + * + * Why? Because subsequent API calls may call getpw*() as a part of + * their implementation. Since getpw*() returns a [now thread scoped] + * global, we must therefore cache the results before continuing. + */ + + desired_uid = pwe->pw_uid; + desired_gid = pwe->pw_gid; + strlcpy(shellpath, pwe->pw_shell, sizeof(shellpath)); strlcpy(loginname, pwe->pw_name, sizeof(loginname)); strlcpy(homedir, pwe->pw_dir, sizeof(homedir)); @@ -2616,8 +2627,6 @@ _exit(EXIT_FAILURE); } - desired_uid = pwe->pw_uid; - desired_gid = pwe->pw_gid; if (j->username && strcmp(j->username, loginname) != 0) { job_log(j, LOG_WARNING, "Suspicious setup: User \"%s\" maps to user: %s", j->username, loginname);
participants (1)
-
source_changes@macosforge.org