Changeset 23544
- Timestamp:
- 03/10/08 14:09:42 (9 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/SULeopard/launchd/src/launchd_core_logic.c
r23527 r23544 171 171 int *fds; 172 172 unsigned int junkfds:1, fd_cnt:31; 173 char name[0]; 173 union { 174 const char name[0]; 175 char name_init[0]; 176 }; 174 177 }; 175 178 … … 203 206 SLIST_ENTRY(envitem) sle; 204 207 char *value; 205 char key[0]; 208 union { 209 const char key[0]; 210 char key_init[0]; 211 }; 206 212 }; 207 213 … … 243 249 semaphore_reason_t why; 244 250 int fd; 245 char what[0]; 251 union { 252 const char what[0]; 253 char what_init[0]; 254 }; 246 255 }; 247 256 … … 280 289 unsigned int normal_active_cnt; 281 290 unsigned int sent_stop_to_normal_jobs:1, sent_stop_to_hopefully_last_jobs:1, shutting_down:1, session_initialized:1; 282 char name[0]; 291 union { 292 const char name[0]; 293 char name_init[0]; 294 }; 283 295 }; 284 296 … … 3335 3347 semaphoreitem_watch(job_t j, struct semaphoreitem *si) 3336 3348 { 3337 char parentdir_path[PATH_MAX], *which_path = si->what; 3349 char *parentdir, tmp_path[PATH_MAX]; 3350 const char *which_path = si->what; 3338 3351 int saved_errno = 0; 3339 3352 int fflags = 0; 3340 3341 strlcpy(parentdir_path, dirname(si->what), sizeof(parentdir_path));3342 3353 3343 3354 switch (si->why) { … … 3353 3364 break; 3354 3365 default: 3366 return; 3367 } 3368 3369 /* dirname() may modify tmp_path */ 3370 strlcpy(tmp_path, si->what, sizeof(tmp_path)); 3371 3372 if (!job_assumes(j, (parentdir = dirname(tmp_path)))) { 3355 3373 return; 3356 3374 } … … 3360 3378 if (si->fd == -1) { 3361 3379 if ((si->fd = _fd(open(which_path, O_EVTONLY|O_NOCTTY))) == -1) { 3362 which_path = parentdir _path;3380 which_path = parentdir; 3363 3381 si->fd = _fd(open(which_path, O_EVTONLY|O_NOCTTY)); 3364 3382 } … … 3601 3619 3602 3620 memcpy(sg->fds, fds, fd_cnt * sizeof(int)); 3603 strcpy(sg->name , name);3621 strcpy(sg->name_init, name); 3604 3622 3605 3623 SLIST_INSERT_HEAD(&j->sockets, sg, sle); … … 3693 3711 } 3694 3712 3695 strcpy(ei->key , k);3696 ei->value = ei->key + strlen(k) + 1;3713 strcpy(ei->key_init, k); 3714 ei->value = ei->key_init + strlen(k) + 1; 3697 3715 strcpy(ei->value, v); 3698 3716 … … 4402 4420 4403 4421 jmr->kqjobmgr_callback = jobmgr_callback; 4404 strcpy(jmr->name , name ? name : "Under construction");4422 strcpy(jmr->name_init, name ? name : "Under construction"); 4405 4423 4406 4424 jmr->req_port = requestorport; … … 4450 4468 4451 4469 if (!name) { 4452 sprintf(jmr->name , "%u", MACH_PORT_INDEX(jmr->jm_port));4470 sprintf(jmr->name_init, "%u", MACH_PORT_INDEX(jmr->jm_port)); 4453 4471 } 4454 4472 … … 4890 4908 4891 4909 if (what) { 4892 strcpy(si->what , what);4910 strcpy(si->what_init, what); 4893 4911 } 4894 4912 … … 6169 6187 6170 6188 jobmgr_log(j->mgr, LOG_DEBUG, "Renaming to: %s", session_type); 6171 strcpy(j->mgr->name , session_type);6189 strcpy(j->mgr->name_init, session_type); 6172 6190 6173 6191 if (job_assumes(j, (j2 = jobmgr_init_session(j->mgr, session_type, false)))) {

