[launchd-changes] [22982] trunk/launchd/src/launchd_core_logic.c
source_changes at macosforge.org
source_changes at macosforge.org
Thu Dec 14 11:59:58 PST 2006
Revision: 22982
http://trac.macosforge.org/projects/launchd/changeset/22982
Author: zarzycki at apple.com
Date: 2006-12-14 11:59:58 -0800 (Thu, 14 Dec 2006)
Log Message:
-----------
<rdar://problem/4619009> spawn_env attribute with spawn_via_launchd doesn't seem to work
Modified Paths:
--------------
trunk/launchd/src/launchd_core_logic.c
Modified: trunk/launchd/src/launchd_core_logic.c
===================================================================
--- trunk/launchd/src/launchd_core_logic.c 2006-12-14 19:18:26 UTC (rev 22981)
+++ trunk/launchd/src/launchd_core_logic.c 2006-12-14 19:59:58 UTC (rev 22982)
@@ -811,6 +811,7 @@
job_new_spawn(job_t j, const char *label, const char *path, const char *workingdir, const char *const *argv, const char *const *env, mode_t *u_mask, bool w4d, bool fppc)
{
job_t jr;
+ size_t i;
if ((jr = jobmgr_find(root_jobmgr, label)) != NULL) {
errno = EEXIST;
@@ -845,15 +846,20 @@
jr->setmask = true;
}
- if (env) for (; *env; env++) {
- char newkey[strlen(*env) + 1], *eqoff = strchr(*env, '=');
+ if (env) for (i = 0; env[i]; i++) {
+ char *eqoff, tmpstr[strlen(env[i]) + 1];
+
+ strcpy(tmpstr, env[i]);
+
+ eqoff = strchr(tmpstr, '=');
+
if (!eqoff) {
- job_log(jr, LOG_WARNING, "Environmental variable missing '=' separator: %s", *env);
+ job_log(jr, LOG_WARNING, "Environmental variable missing '=' separator: %s", tmpstr);
continue;
}
- strcpy(newkey, *env);
+
*eqoff = '\0';
- envitem_new(jr, newkey, eqoff + 1, false);
+ envitem_new(jr, tmpstr, eqoff + 1, false);
}
job_dispatch(jr, true);
@@ -2575,6 +2581,8 @@
SLIST_INSERT_HEAD(&j->env, ei, sle);
}
+ job_log(j, LOG_DEBUG, "Added environmental variable: %s=%s", k, v);
+
return true;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/launchd-changes/attachments/20061214/845648a4/attachment.html
More information about the launchd-changes
mailing list