/[baselayout]/trunk/src/librc-daemon.c
Gentoo

Diff of /trunk/src/librc-daemon.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 2607 Revision 2634
303 if (exec) { 303 if (exec) {
304 i = strlen (exec) + 6; 304 i = strlen (exec) + 6;
305 mexec = rc_xmalloc (sizeof (char *) * i); 305 mexec = rc_xmalloc (sizeof (char *) * i);
306 snprintf (mexec, i, "exec=%s", exec); 306 snprintf (mexec, i, "exec=%s", exec);
307 } else 307 } else
308 mexec = strdup ("exec="); 308 mexec = rc_xstrdup ("exec=");
309 309
310 if (name) { 310 if (name) {
311 i = strlen (name) + 6; 311 i = strlen (name) + 6;
312 mname = rc_xmalloc (sizeof (char *) * i); 312 mname = rc_xmalloc (sizeof (char *) * i);
313 snprintf (mname, i, "name=%s", name); 313 snprintf (mname, i, "name=%s", name);
314 } else 314 } else
315 mname = strdup ("name="); 315 mname = rc_xstrdup ("name=");
316 316
317 if (pidfile) { 317 if (pidfile) {
318 i = strlen (pidfile) + 9; 318 i = strlen (pidfile) + 9;
319 mpidfile = rc_xmalloc (sizeof (char *) * i); 319 mpidfile = rc_xmalloc (sizeof (char *) * i);
320 snprintf (mpidfile, i, "pidfile=%s", pidfile); 320 snprintf (mpidfile, i, "pidfile=%s", pidfile);
321 } else 321 } else
322 mpidfile = strdup ("pidfile="); 322 mpidfile = rc_xstrdup ("pidfile=");
323 323
324 /* Regardless, erase any existing daemon info */ 324 /* Regardless, erase any existing daemon info */
325 if (rc_is_dir (dirpath)) { 325 if (rc_is_dir (dirpath)) {
326 char *oldfile = NULL; 326 char *oldfile = NULL;
327 files = rc_ls_dir (NULL, dirpath, 0); 327 files = rc_ls_dir (NULL, dirpath, 0);
477 continue; 477 continue;
478 478
479 if (strcmp (token, "exec") == 0) { 479 if (strcmp (token, "exec") == 0) {
480 if (exec) 480 if (exec)
481 free (exec); 481 free (exec);
482 exec = strdup (p); 482 exec = rc_xstrdup (p);
483 } else if (strcmp (token, "name") == 0) { 483 } else if (strcmp (token, "name") == 0) {
484 if (name) 484 if (name)
485 free (name); 485 free (name);
486 name = strdup (p); 486 name = rc_xstrdup (p);
487 } else if (strcmp (token, "pidfile") == 0) { 487 } else if (strcmp (token, "pidfile") == 0) {
488 if (pidfile) 488 if (pidfile)
489 free (pidfile); 489 free (pidfile);
490 pidfile = strdup (p); 490 pidfile = rc_xstrdup (p);
491 } 491 }
492 } 492 }
493 fclose (fp); 493 fclose (fp);
494 494
495 pid = 0; 495 pid = 0;

Legend:
Removed from v.2607  
changed lines
  Added in v.2634

  ViewVC Help
Powered by ViewVC 1.1.20