/[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 2597 Revision 2607
282 282
283void rc_set_service_daemon (const char *service, const char *exec, 283void rc_set_service_daemon (const char *service, const char *exec,
284 const char *name, const char *pidfile, 284 const char *name, const char *pidfile,
285 bool started) 285 bool started)
286{ 286{
287 char *svc = rc_xstrdup (service);
287 char *dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", basename (service), 288 char *dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", basename (svc),
288 (char *) NULL); 289 (char *) NULL);
289 char **files = NULL; 290 char **files = NULL;
290 char *file; 291 char *file;
291 char *ffile = NULL; 292 char *ffile = NULL;
292 int i; 293 int i;
293 char *mexec; 294 char *mexec;
294 char *mname; 295 char *mname;
295 char *mpidfile; 296 char *mpidfile;
296 int nfiles = 0; 297 int nfiles = 0;
297 298
299 free (svc);
298 if (! exec && ! name && ! pidfile) 300 if (! exec && ! name && ! pidfile)
299 return; 301 return;
300 302
301 if (exec) { 303 if (exec) {
302 i = strlen (exec) + 6; 304 i = strlen (exec) + 6;
377 char *dirpath; 379 char *dirpath;
378 char *file; 380 char *file;
379 int i; 381 int i;
380 char *mexec; 382 char *mexec;
381 bool retval = false; 383 bool retval = false;
384 char *svc;
382 385
383 if (! service || ! exec) 386 if (! service || ! exec)
384 return (false); 387 return (false);
385 388
389 svc = rc_xstrdup (service);
386 dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", basename (service), 390 dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", basename (svc),
387 (char *) NULL); 391 (char *) NULL);
392 free (svc);
393
388 if (! rc_is_dir (dirpath)) { 394 if (! rc_is_dir (dirpath)) {
389 free (dirpath); 395 free (dirpath);
390 return (false); 396 return (false);
391 } 397 }
392 398
430 pid_t pid = 0; 436 pid_t pid = 0;
431 pid_t *pids = NULL; 437 pid_t *pids = NULL;
432 char *p; 438 char *p;
433 char *token; 439 char *token;
434 bool retval = false; 440 bool retval = false;
441 char *svc;
435 442
436 if (! service) 443 if (! service)
437 return (false); 444 return (false);
438 445
446 svc = rc_xstrdup (service);
439 dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", basename (service), 447 dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", basename (svc),
440 (char *) NULL); 448 (char *) NULL);
449 free (svc);
450
441 if (! rc_is_dir (dirpath)) { 451 if (! rc_is_dir (dirpath)) {
442 free (dirpath); 452 free (dirpath);
443 return (false); 453 return (false);
444 } 454 }
445 455

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

  ViewVC Help
Powered by ViewVC 1.1.20