aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-04-13 16:00:25 +0000
committerRoy Marples <roy@marples.name>2007-04-13 16:00:25 +0000
commit6ff4a83d591c77acc268db8a5b8c0b2011adbf31 (patch)
treeacde7bcaabaf47a4f731de84beb6a9539afe794c /src
parent271426304062de4825060b2c2acb5061910d1016 (diff)
More basename compliance.
Diffstat (limited to 'src')
-rw-r--r--src/librc-daemon.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/librc-daemon.c b/src/librc-daemon.c
index 4473cc16..23dfc01a 100644
--- a/src/librc-daemon.c
+++ b/src/librc-daemon.c
@@ -284,7 +284,8 @@ void rc_set_service_daemon (const char *service, const char *exec,
const char *name, const char *pidfile,
bool started)
{
- char *dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", basename (service),
+ char *svc = rc_xstrdup (service);
+ char *dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", basename (svc),
(char *) NULL);
char **files = NULL;
char *file;
@@ -295,6 +296,7 @@ void rc_set_service_daemon (const char *service, const char *exec,
char *mpidfile;
int nfiles = 0;
+ free (svc);
if (! exec && ! name && ! pidfile)
return;
@@ -379,12 +381,16 @@ bool rc_service_started_daemon (const char *service, const char *exec,
int i;
char *mexec;
bool retval = false;
+ char *svc;
if (! service || ! exec)
return (false);
- dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", basename (service),
+ svc = rc_xstrdup (service);
+ dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", basename (svc),
(char *) NULL);
+ free (svc);
+
if (! rc_is_dir (dirpath)) {
free (dirpath);
return (false);
@@ -432,12 +438,16 @@ bool rc_service_daemons_crashed (const char *service)
char *p;
char *token;
bool retval = false;
+ char *svc;
if (! service)
return (false);
- dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", basename (service),
+ svc = rc_xstrdup (service);
+ dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", basename (svc),
(char *) NULL);
+ free (svc);
+
if (! rc_is_dir (dirpath)) {
free (dirpath);
return (false);