/[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 2866 Revision 2928
322 mpidfile = rc_xstrdup ("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 (dirpath, 0);
328 STRLIST_FOREACH (files, file, i) { 328 STRLIST_FOREACH (files, file, i) {
329 ffile = rc_strcatpaths (dirpath, file, (char *) NULL); 329 ffile = rc_strcatpaths (dirpath, file, (char *) NULL);
330 nfiles++; 330 nfiles++;
331 331
332 if (! oldfile) { 332 if (! oldfile) {
339 rename (ffile, oldfile); 339 rename (ffile, oldfile);
340 free (oldfile); 340 free (oldfile);
341 oldfile = ffile; 341 oldfile = ffile;
342 } 342 }
343 } 343 }
344 if (ffile)
345 free (ffile); 344 free (ffile);
346 free (files); 345 rc_strlist_free (files);
347 } 346 }
348 347
349 /* Now store our daemon info */ 348 /* Now store our daemon info */
350 if (started) { 349 if (started) {
351 char buffer[10]; 350 char buffer[10];
405 file = rc_xmalloc (len); 404 file = rc_xmalloc (len);
406 snprintf (file, len, "%03d", indx); 405 snprintf (file, len, "%03d", indx);
407 retval = _match_daemon (dirpath, file, mexec, NULL, NULL); 406 retval = _match_daemon (dirpath, file, mexec, NULL, NULL);
408 free (file); 407 free (file);
409 } else { 408 } else {
410 char **files = rc_ls_dir (NULL, dirpath, 0); 409 char **files = rc_ls_dir (dirpath, 0);
411 STRLIST_FOREACH (files, file, i) { 410 STRLIST_FOREACH (files, file, i) {
412 retval = _match_daemon (dirpath, file, mexec, NULL, NULL); 411 retval = _match_daemon (dirpath, file, mexec, NULL, NULL);
413 if (retval) 412 if (retval)
414 break; 413 break;
415 } 414 }
416 free (files); 415 rc_strlist_free (files);
417 } 416 }
418 417
419 free (mexec); 418 free (mexec);
420 return (retval); 419 return (retval);
421} 420}
452 free (dirpath); 451 free (dirpath);
453 return (false); 452 return (false);
454 } 453 }
455 454
456 memset (buffer, 0, sizeof (buffer)); 455 memset (buffer, 0, sizeof (buffer));
457 files = rc_ls_dir (NULL, dirpath, 0); 456 files = rc_ls_dir (dirpath, 0);
458 STRLIST_FOREACH (files, file, i) { 457 STRLIST_FOREACH (files, file, i) {
459 path = rc_strcatpaths (dirpath, file, (char *) NULL); 458 path = rc_strcatpaths (dirpath, file, (char *) NULL);
460 fp = fopen (path, "r"); 459 fp = fopen (path, "r");
461 free (path); 460 free (path);
462 if (! fp) { 461 if (! fp) {

Legend:
Removed from v.2866  
changed lines
  Added in v.2928

  ViewVC Help
Powered by ViewVC 1.1.20