Changeset 23543
- Timestamp:
- 2008-03-10 13:49:07 (7 months ago)
- Files:
-
- 1 modified
-
trunk/launchd/src/launchd_core_logic.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/launchd/src/launchd_core_logic.c
r23540 r23543 173 173 int *fds; 174 174 unsigned int junkfds:1, fd_cnt:31; 175 char name[0]; 175 union { 176 const char name[0]; 177 char name_init[0]; 178 }; 176 179 }; 177 180 … … 205 208 SLIST_ENTRY(envitem) sle; 206 209 char *value; 207 char key[0]; 210 union { 211 const char key[0]; 212 char key_init[0]; 213 }; 208 214 }; 209 215 … … 245 251 semaphore_reason_t why; 246 252 int fd; 247 char what[0]; 253 union { 254 const char what[0]; 255 char what_init[0]; 256 }; 248 257 }; 249 258 … … 283 292 unsigned int normal_active_cnt; 284 293 unsigned int sent_stop_to_normal_jobs:1, sent_stop_to_hopefully_last_jobs:1, shutting_down:1, session_initialized:1, __junk:28; 285 char name[0]; 294 union { 295 const char name[0]; 296 char name_init[0]; 297 }; 286 298 }; 287 299 … … 3500 3512 semaphoreitem_watch(job_t j, struct semaphoreitem *si) 3501 3513 { 3502 char parentdir_path[PATH_MAX], *which_path = si->what; 3514 char *parentdir, tmp_path[PATH_MAX]; 3515 const char *which_path = si->what; 3503 3516 int saved_errno = 0; 3504 3517 int fflags = 0; 3505 3506 strlcpy(parentdir_path, dirname(si->what), sizeof(parentdir_path));3507 3518 3508 3519 switch (si->why) { … … 3518 3529 break; 3519 3530 default: 3531 return; 3532 } 3533 3534 /* dirname() may modify tmp_path */ 3535 strlcpy(tmp_path, si->what, sizeof(tmp_path)); 3536 3537 if (!job_assumes(j, (parentdir = dirname(tmp_path)))) { 3520 3538 return; 3521 3539 } … … 3525 3543 if (si->fd == -1) { 3526 3544 if ((si->fd = _fd(open(which_path, O_EVTONLY|O_NOCTTY))) == -1) { 3527 which_path = parentdir _path;3545 which_path = parentdir; 3528 3546 si->fd = _fd(open(which_path, O_EVTONLY|O_NOCTTY)); 3529 3547 } … … 3766 3784 3767 3785 memcpy(sg->fds, fds, fd_cnt * sizeof(int)); 3768 strcpy(sg->name , name);3786 strcpy(sg->name_init, name); 3769 3787 3770 3788 SLIST_INSERT_HEAD(&j->sockets, sg, sle); … … 3858 3876 } 3859 3877 3860 strcpy(ei->key , k);3861 ei->value = ei->key + strlen(k) + 1;3878 strcpy(ei->key_init, k); 3879 ei->value = ei->key_init + strlen(k) + 1; 3862 3880 strcpy(ei->value, v); 3863 3881 … … 4556 4574 4557 4575 jmr->kqjobmgr_callback = jobmgr_callback; 4558 strcpy(jmr->name , name ? name : "Under construction");4576 strcpy(jmr->name_init, name ? name : "Under construction"); 4559 4577 4560 4578 jmr->req_port = requestorport; … … 4604 4622 4605 4623 if (!name) { 4606 sprintf(jmr->name , "%u", MACH_PORT_INDEX(jmr->jm_port));4624 sprintf(jmr->name_init, "%u", MACH_PORT_INDEX(jmr->jm_port)); 4607 4625 } 4608 4626 … … 5046 5064 5047 5065 if (what) { 5048 strcpy(si->what , what);5066 strcpy(si->what_init, what); 5049 5067 } 5050 5068 … … 6326 6344 6327 6345 jobmgr_log(j->mgr, LOG_DEBUG, "Renaming to: %s", session_type); 6328 strcpy(j->mgr->name , session_type);6346 strcpy(j->mgr->name_init, session_type); 6329 6347 6330 6348 if (job_assumes(j, (j2 = jobmgr_init_session(j->mgr, session_type, false)))) {

