Wups, should be xstrdup

This commit is contained in:
Roy Marples
2007-10-08 11:16:22 +00:00
parent a89ceb7e2c
commit cd4bce7e8d
12 changed files with 58 additions and 58 deletions

View File

@@ -152,7 +152,7 @@ int env_update (int argc, char **argv)
entries = rc_config_load (path); entries = rc_config_load (path);
STRLIST_FOREACH (entries, entry, j) { STRLIST_FOREACH (entries, entry, j) {
char *tmpent = strdup (entry); char *tmpent = xstrdup (entry);
char *value = tmpent; char *value = tmpent;
char *var = strsep (&value, "="); char *var = strsep (&value, "=");
@@ -176,7 +176,7 @@ int env_update (int argc, char **argv)
eerrorx ("%s: nothing to process", applet); eerrorx ("%s: nothing to process", applet);
STRLIST_FOREACH (config, entry, i) { STRLIST_FOREACH (config, entry, i) {
char *tmpent = strdup (entry); char *tmpent = xstrdup (entry);
char *value = tmpent; char *value = tmpent;
char *var = strsep (&value, "="); char *var = strsep (&value, "=");
char *match; char *match;
@@ -220,7 +220,7 @@ int env_update (int argc, char **argv)
} }
STRLIST_FOREACH (envs, env, j) { STRLIST_FOREACH (envs, env, j) {
char *tmpenv = strdup (env); char *tmpenv = xstrdup (env);
char *tmpvalue = tmpenv; char *tmpvalue = tmpenv;
char *tmpentry = strsep (&tmpvalue, "="); char *tmpentry = strsep (&tmpvalue, "=");
@@ -232,7 +232,7 @@ int env_update (int argc, char **argv)
"%s%s", colon ? ":" : " ", value); "%s%s", colon ? ":" : " ", value);
} else { } else {
free (envs[j - 1]); free (envs[j - 1]);
envs[j - 1] = strdup (entry); envs[j - 1] = xstrdup (entry);
} }
replaced = true; replaced = true;
} }
@@ -256,7 +256,7 @@ int env_update (int argc, char **argv)
fprintf (fp, NOTICE, "/etc/profile", PROFILE_ENV); fprintf (fp, NOTICE, "/etc/profile", PROFILE_ENV);
STRLIST_FOREACH (envs, env, i) { STRLIST_FOREACH (envs, env, i) {
char *tmpent = strdup (env); char *tmpent = xstrdup (env);
char *value = tmpent; char *value = tmpent;
char *var = strsep (&value, "="); char *var = strsep (&value, "=");
if (strcmp (var, "LDPATH") != 0) { if (strcmp (var, "LDPATH") != 0) {
@@ -274,7 +274,7 @@ int env_update (int argc, char **argv)
fprintf (fp, NOTICE, "/etc/csh.cshrc", PROFILE_ENV); fprintf (fp, NOTICE, "/etc/csh.cshrc", PROFILE_ENV);
STRLIST_FOREACH (envs, env, i) { STRLIST_FOREACH (envs, env, i) {
char *tmpent = strdup (env); char *tmpent = xstrdup (env);
char *value = tmpent; char *value = tmpent;
char *var = strsep (&value, "="); char *var = strsep (&value, "=");
if (strcmp (var, "LDPATH") != 0) { if (strcmp (var, "LDPATH") != 0) {

View File

@@ -304,7 +304,7 @@ bool rc_service_daemon_set (const char *service, const char *exec,
errno = EINVAL; errno = EINVAL;
return (false); return (false);
} }
svc = strdup (service); svc = xstrdup (service);
dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", dirpath = rc_strcatpaths (RC_SVCDIR, "daemons",
basename (svc), (char *) NULL); basename (svc), (char *) NULL);
free (svc); free (svc);
@@ -314,21 +314,21 @@ bool rc_service_daemon_set (const char *service, const char *exec,
mexec = xmalloc (sizeof (char *) * i); mexec = xmalloc (sizeof (char *) * i);
snprintf (mexec, i, "exec=%s", exec); snprintf (mexec, i, "exec=%s", exec);
} else } else
mexec = strdup ("exec="); mexec = xstrdup ("exec=");
if (name) { if (name) {
i = strlen (name) + 6; i = strlen (name) + 6;
mname = xmalloc (sizeof (char *) * i); mname = xmalloc (sizeof (char *) * i);
snprintf (mname, i, "name=%s", name); snprintf (mname, i, "name=%s", name);
} else } else
mname = strdup ("name="); mname = xstrdup ("name=");
if (pidfile) { if (pidfile) {
i = strlen (pidfile) + 9; i = strlen (pidfile) + 9;
mpidfile = xmalloc (sizeof (char *) * i); mpidfile = xmalloc (sizeof (char *) * i);
snprintf (mpidfile, i, "pidfile=%s", pidfile); snprintf (mpidfile, i, "pidfile=%s", pidfile);
} else } else
mpidfile = strdup ("pidfile="); mpidfile = xstrdup ("pidfile=");
/* Regardless, erase any existing daemon info */ /* Regardless, erase any existing daemon info */
if ((dp = opendir (dirpath))) { if ((dp = opendir (dirpath))) {
@@ -398,7 +398,7 @@ bool rc_service_started_daemon (const char *service, const char *exec,
if (! service || ! exec) if (! service || ! exec)
return (false); return (false);
svc = strdup (service); svc = xstrdup (service);
dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", basename (svc), dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", basename (svc),
(char *) NULL); (char *) NULL);
free (svc); free (svc);
@@ -453,7 +453,7 @@ bool rc_service_daemons_crashed (const char *service)
if (! service) if (! service)
return (false); return (false);
svc = strdup (service); svc = xstrdup (service);
dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", basename (svc), dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", basename (svc),
(char *) NULL); (char *) NULL);
free (svc); free (svc);
@@ -488,15 +488,15 @@ bool rc_service_daemons_crashed (const char *service)
if (strcmp (token, "exec") == 0) { if (strcmp (token, "exec") == 0) {
if (exec) if (exec)
free (exec); free (exec);
exec = strdup (p); exec = xstrdup (p);
} else if (strcmp (token, "name") == 0) { } else if (strcmp (token, "name") == 0) {
if (name) if (name)
free (name); free (name);
name = strdup (p); name = xstrdup (p);
} else if (strcmp (token, "pidfile") == 0) { } else if (strcmp (token, "pidfile") == 0) {
if (pidfile) if (pidfile)
free (pidfile); free (pidfile);
pidfile = strdup (p); pidfile = xstrdup (p);
} }
} }
fclose (fp); fclose (fp);

View File

@@ -110,7 +110,7 @@ rc_depinfo_t *rc_deptree_load (void)
depinfo = depinfo->next; depinfo = depinfo->next;
} }
memset (depinfo, 0, sizeof (rc_depinfo_t)); memset (depinfo, 0, sizeof (rc_depinfo_t));
depinfo->service = strdup (e); depinfo->service = xstrdup (e);
deptype = NULL; deptype = NULL;
continue; continue;
} }
@@ -139,7 +139,7 @@ rc_depinfo_t *rc_deptree_load (void)
} }
if (! deptype->type) if (! deptype->type)
deptype->type = strdup (type); deptype->type = xstrdup (type);
rc_strlist_addsort (&deptype->services, e); rc_strlist_addsort (&deptype->services, e);
} }
@@ -717,7 +717,7 @@ bool rc_deptree_update (void)
depinfo = last_depinfo->next; depinfo = last_depinfo->next;
} }
memset (depinfo, 0, sizeof (rc_depinfo_t)); memset (depinfo, 0, sizeof (rc_depinfo_t));
depinfo->service = strdup (service); depinfo->service = xstrdup (service);
} }
/* We may not have any depends */ /* We may not have any depends */
@@ -747,7 +747,7 @@ bool rc_deptree_update (void)
deptype = last_deptype->next; deptype = last_deptype->next;
} }
memset (deptype, 0, sizeof (rc_deptype_t)); memset (deptype, 0, sizeof (rc_deptype_t));
deptype->type = strdup (type); deptype->type = xstrdup (type);
} }
} }
@@ -794,7 +794,7 @@ bool rc_deptree_update (void)
last_depinfo->next = xmalloc (sizeof (rc_depinfo_t)); last_depinfo->next = xmalloc (sizeof (rc_depinfo_t));
di = last_depinfo->next; di = last_depinfo->next;
memset (di, 0, sizeof (rc_depinfo_t)); memset (di, 0, sizeof (rc_depinfo_t));
di->service = strdup (service); di->service = xstrdup (service);
} }
} }
} }
@@ -844,7 +844,7 @@ bool rc_deptree_update (void)
dt = last_deptype->next; dt = last_deptype->next;
} }
memset (dt, 0, sizeof (rc_deptype_t)); memset (dt, 0, sizeof (rc_deptype_t));
dt->type = strdup (deppairs[i].addto); dt->type = xstrdup (deppairs[i].addto);
} }
already_added = false; already_added = false;

View File

@@ -120,7 +120,7 @@ char **rc_config_load (const char *file)
if (! token) if (! token)
continue; continue;
entry = strdup (token); entry = xstrdup (token);
/* Preserve shell coloring */ /* Preserve shell coloring */
if (*p == '$') if (*p == '$')
@@ -144,7 +144,7 @@ char **rc_config_load (const char *file)
/* In shells the last item takes precedence, so we need to remove /* In shells the last item takes precedence, so we need to remove
any prior values we may already have */ any prior values we may already have */
STRLIST_FOREACH (list, line, i) { STRLIST_FOREACH (list, line, i) {
char *tmp = strdup (line); char *tmp = xstrdup (line);
linep = tmp; linep = tmp;
linetok = strsep (&linep, "="); linetok = strsep (&linep, "=");
if (strcmp (linetok, entry) == 0) { if (strcmp (linetok, entry) == 0) {

View File

@@ -27,7 +27,7 @@ static char *_rc_strlist_add (char ***list, const char *item, bool uniq)
} }
newlist = xrealloc (lst, sizeof (char *) * (i + 2)); newlist = xrealloc (lst, sizeof (char *) * (i + 2));
newlist[i] = strdup (item); newlist[i] = xstrdup (item);
newlist[i + 1] = NULL; newlist[i + 1] = NULL;
*list = newlist; *list = newlist;
@@ -80,7 +80,7 @@ static char *_rc_strlist_addsort (char ***list, const char *item,
i++; i++;
tmp1 = newlist[i]; tmp1 = newlist[i];
retval = newlist[i] = strdup (item); retval = newlist[i] = xstrdup (item);
do { do {
i++; i++;
tmp2 = newlist[i]; tmp2 = newlist[i];

View File

@@ -164,13 +164,13 @@ char *rc_runlevel_get (void)
int i = strlen (buffer) - 1; int i = strlen (buffer) - 1;
if (buffer[i] == '\n') if (buffer[i] == '\n')
buffer[i] = 0; buffer[i] = 0;
runlevel = strdup (buffer); runlevel = xstrdup (buffer);
} }
fclose (fp); fclose (fp);
} }
if (! runlevel) if (! runlevel)
runlevel = strdup (RC_LEVEL_SYSINIT); runlevel = xstrdup (RC_LEVEL_SYSINIT);
return (runlevel); return (runlevel);
} }
@@ -217,7 +217,7 @@ char *rc_service_resolve (const char *service)
return (NULL); return (NULL);
if (service[0] == '/') if (service[0] == '/')
return (strdup (service)); return (xstrdup (service));
file = rc_strcatpaths (RC_SVCDIR, "started", service, (char *) NULL); file = rc_strcatpaths (RC_SVCDIR, "started", service, (char *) NULL);
if (lstat (file, &buf) || ! S_ISLNK (buf.st_mode)) { if (lstat (file, &buf) || ! S_ISLNK (buf.st_mode)) {
@@ -234,11 +234,11 @@ char *rc_service_resolve (const char *service)
r = readlink (file, buffer, sizeof (buffer)); r = readlink (file, buffer, sizeof (buffer));
free (file); free (file);
if (r > 0) if (r > 0)
return (strdup (buffer)); return (xstrdup (buffer));
} }
snprintf (buffer, sizeof (buffer), RC_INITDIR "/%s", service); snprintf (buffer, sizeof (buffer), RC_INITDIR "/%s", service);
return (strdup (buffer)); return (xstrdup (buffer));
} }
librc_hidden_def(rc_service_resolve) librc_hidden_def(rc_service_resolve)
@@ -344,7 +344,7 @@ bool rc_service_in_runlevel (const char *service, const char *runlevel)
if (! runlevel || ! service) if (! runlevel || ! service)
return (false); return (false);
svc = strdup (service); svc = xstrdup (service);
file = rc_strcatpaths (RC_RUNLEVELDIR, runlevel, basename (svc), file = rc_strcatpaths (RC_RUNLEVELDIR, runlevel, basename (svc),
(char *) NULL); (char *) NULL);
free (svc); free (svc);
@@ -368,7 +368,7 @@ bool rc_service_mark (const char *service, const rc_service_state_t state)
if (! service) if (! service)
return (false); return (false);
svc = strdup (service); svc = xstrdup (service);
base = basename (svc); base = basename (svc);
if (state != RC_SERVICE_STOPPED) { if (state != RC_SERVICE_STOPPED) {
@@ -487,7 +487,7 @@ rc_service_state_t rc_service_state (const char *service)
{ {
int i; int i;
int state = RC_SERVICE_STOPPED; int state = RC_SERVICE_STOPPED;
char *svc = strdup (service); char *svc = xstrdup (service);
for (i = 0; rc_service_state_names[i].name; i++) { for (i = 0; rc_service_state_names[i].name; i++) {
char *file = rc_strcatpaths (RC_SVCDIR, rc_service_state_names[i].name, char *file = rc_strcatpaths (RC_SVCDIR, rc_service_state_names[i].name,
@@ -525,7 +525,7 @@ char *rc_service_value_get (const char *service, const char *option)
if ((fp = fopen (file, "r"))) { if ((fp = fopen (file, "r"))) {
memset (buffer, 0, sizeof (buffer)); memset (buffer, 0, sizeof (buffer));
if (fgets (buffer, RC_LINEBUFFER, fp)) if (fgets (buffer, RC_LINEBUFFER, fp))
value = strdup (buffer); value = xstrdup (buffer);
fclose (fp); fclose (fp);
} }
free (file); free (file);
@@ -576,7 +576,7 @@ static pid_t _exec_service (const char *service, const char *arg)
} }
/* We create a fifo so that other services can wait until we complete */ /* We create a fifo so that other services can wait until we complete */
svc = strdup (service); svc = xstrdup (service);
fifo = rc_strcatpaths (RC_SVCDIR, "exclusive", basename (svc), fifo = rc_strcatpaths (RC_SVCDIR, "exclusive", basename (svc),
(char *) NULL); (char *) NULL);
free (svc); free (svc);
@@ -634,7 +634,7 @@ bool rc_service_schedule_start (const char *service,
if (! service || ! rc_service_exists (service_to_start)) if (! service || ! rc_service_exists (service_to_start))
return (false); return (false);
svc = strdup (service); svc = xstrdup (service);
dir = rc_strcatpaths (RC_SVCDIR, "scheduled", basename (svc), dir = rc_strcatpaths (RC_SVCDIR, "scheduled", basename (svc),
(char *) NULL); (char *) NULL);
free (svc); free (svc);
@@ -644,7 +644,7 @@ bool rc_service_schedule_start (const char *service,
} }
init = rc_service_resolve (service_to_start); init = rc_service_resolve (service_to_start);
svc = strdup (service_to_start); svc = xstrdup (service_to_start);
file = rc_strcatpaths (dir, basename (svc), (char *) NULL); file = rc_strcatpaths (dir, basename (svc), (char *) NULL);
free (svc); free (svc);
retval = (exists (file) || symlink (init, file) == 0); retval = (exists (file) || symlink (init, file) == 0);
@@ -658,7 +658,7 @@ librc_hidden_def(rc_service_schedule_start)
bool rc_service_schedule_clear (const char *service) bool rc_service_schedule_clear (const char *service)
{ {
char *svc = strdup (service); char *svc = xstrdup (service);
char *dir = rc_strcatpaths (RC_SVCDIR, "scheduled", basename (svc), char *dir = rc_strcatpaths (RC_SVCDIR, "scheduled", basename (svc),
(char *) NULL); (char *) NULL);
bool retval; bool retval;
@@ -684,7 +684,7 @@ bool rc_service_wait (const char *service)
if (! service) if (! service)
return (false); return (false);
svc = strdup (service); svc = xstrdup (service);
base = basename (svc); base = basename (svc);
fifo = rc_strcatpaths (RC_SVCDIR, "exclusive", base, (char *) NULL); fifo = rc_strcatpaths (RC_SVCDIR, "exclusive", base, (char *) NULL);
/* FIXME: find a better way of doing this /* FIXME: find a better way of doing this
@@ -789,7 +789,7 @@ bool rc_service_add (const char *runlevel, const char *service)
} }
init = rc_service_resolve (service); init = rc_service_resolve (service);
svc = strdup (service); svc = xstrdup (service);
file = rc_strcatpaths (RC_RUNLEVELDIR, runlevel, basename (svc), file = rc_strcatpaths (RC_RUNLEVELDIR, runlevel, basename (svc),
(char *) NULL); (char *) NULL);
free (svc); free (svc);
@@ -809,7 +809,7 @@ bool rc_service_delete (const char *runlevel, const char *service)
if (! runlevel || ! service) if (! runlevel || ! service)
return (false); return (false);
svc = strdup (service); svc = xstrdup (service);
file = rc_strcatpaths (RC_RUNLEVELDIR, runlevel, basename (svc), file = rc_strcatpaths (RC_RUNLEVELDIR, runlevel, basename (svc),
(char *) NULL); (char *) NULL);
free (svc); free (svc);
@@ -843,7 +843,7 @@ librc_hidden_def(rc_services_scheduled_by)
char **rc_services_scheduled (const char *service) char **rc_services_scheduled (const char *service)
{ {
char *svc = strdup (service); char *svc = xstrdup (service);
char *dir = rc_strcatpaths (RC_SVCDIR, "scheduled", basename (svc), char *dir = rc_strcatpaths (RC_SVCDIR, "scheduled", basename (svc),
(char *) NULL); (char *) NULL);
char **list = NULL; char **list = NULL;
@@ -866,7 +866,7 @@ bool rc_service_plugable (char *service)
if (! match) if (! match)
return true; return true;
list = strdup (match); list = xstrdup (match);
p = list; p = list;
while ((token = strsep (&p, " "))) { while ((token = strsep (&p, " "))) {
bool truefalse = true; bool truefalse = true;

View File

@@ -173,7 +173,7 @@ static char **find_mounts (struct args *args)
for (o = optnames; flags && o->o_opt; o++) { for (o = optnames; flags && o->o_opt; o++) {
if (flags & o->o_opt) { if (flags & o->o_opt) {
if (! options) if (! options)
options = strdup (o->o_name); options = xstrdup (o->o_name);
else { else {
char *tmp = NULL; char *tmp = NULL;
asprintf (&tmp, "%s,%s", options, o->o_name); asprintf (&tmp, "%s,%s", options, o->o_name);

View File

@@ -88,7 +88,7 @@ char **env_filter (void)
/* Now go through the env var and only add bits not in our PREFIX */ /* Now go through the env var and only add bits not in our PREFIX */
sep = env_var; sep = env_var;
while ((token = strsep (&sep, ":"))) { while ((token = strsep (&sep, ":"))) {
char *np = strdup (PATH_PREFIX); char *np = xstrdup (PATH_PREFIX);
char *npp = np; char *npp = np;
char *tok = NULL; char *tok = NULL;
while ((tok = strsep (&npp, ":"))) while ((tok = strsep (&npp, ":")))

View File

@@ -91,7 +91,7 @@ void rc_plugin_load (void)
plugin = plugins = xmalloc (sizeof (plugin_t)); plugin = plugins = xmalloc (sizeof (plugin_t));
memset (plugin, 0, sizeof (plugin_t)); memset (plugin, 0, sizeof (plugin_t));
plugin->name = strdup (d->d_name); plugin->name = xstrdup (d->d_name);
plugin->handle = h; plugin->handle = h;
plugin->hook = fptr; plugin->hook = fptr;
} }

View File

@@ -205,7 +205,7 @@ static int do_e (int argc, char **argv)
} }
if (message) if (message)
fmt = strdup ("%s"); fmt = xstrdup ("%s");
if (strcmp (applet, "einfo") == 0) if (strcmp (applet, "einfo") == 0)
einfo (fmt, message); einfo (fmt, message);
@@ -406,7 +406,7 @@ static char *proc_getent (const char *ent)
p += strlen (ent); p += strlen (ent);
if (*p == '=') if (*p == '=')
p++; p++;
value = strdup (strsep (&p, " ")); value = xstrdup (strsep (&p, " "));
} }
} else } else
errno = ENOENT; errno = ENOENT;
@@ -757,7 +757,7 @@ int main (int argc, char **argv)
atexit (cleanup); atexit (cleanup);
if (argv[0]) if (argv[0])
applet = strdup (basename (argv[0])); applet = xstrdup (basename (argv[0]));
if (! applet) if (! applet)
eerrorx ("arguments required"); eerrorx ("arguments required");
@@ -858,7 +858,7 @@ int main (int argc, char **argv)
some kernels bitch about this according to the environ man pages some kernels bitch about this according to the environ man pages
so we walk though environ and call unsetenv for each value. */ so we walk though environ and call unsetenv for each value. */
while (environ[0]) { while (environ[0]) {
tmp = strdup (environ[0]); tmp = xstrdup (environ[0]);
p = tmp; p = tmp;
var = strsep (&p, "="); var = strsep (&p, "=");
unsetenv (var); unsetenv (var);
@@ -1310,7 +1310,7 @@ int main (int argc, char **argv)
if (newlevel) { if (newlevel) {
rc_runlevel_set (newlevel); rc_runlevel_set (newlevel);
free (runlevel); free (runlevel);
runlevel = strdup (newlevel); runlevel = xstrdup (newlevel);
setenv ("RC_SOFTLEVEL", runlevel, 1); setenv ("RC_SOFTLEVEL", runlevel, 1);
} }

View File

@@ -1009,7 +1009,7 @@ int runscript (int argc, char **argv)
/* We need the full path to the service */ /* We need the full path to the service */
if (*argv[1] == '/') if (*argv[1] == '/')
service = strdup (argv[1]); service = xstrdup (argv[1]);
else { else {
char pwd[PATH_MAX]; char pwd[PATH_MAX];
if (! getcwd (pwd, PATH_MAX)) if (! getcwd (pwd, PATH_MAX))
@@ -1017,7 +1017,7 @@ int runscript (int argc, char **argv)
service = rc_strcatpaths (pwd, argv[1], (char *) NULL); service = rc_strcatpaths (pwd, argv[1], (char *) NULL);
} }
applet = strdup (basename (service)); applet = xstrdup (basename (service));
atexit (cleanup); atexit (cleanup);
/* Change dir to / to ensure all init scripts don't use stuff in pwd */ /* Change dir to / to ensure all init scripts don't use stuff in pwd */
@@ -1043,7 +1043,7 @@ int runscript (int argc, char **argv)
} }
#endif #endif
if ((softlevel = strdup (getenv ("RC_SOFTLEVEL"))) == NULL) { if ((softlevel = xstrdup (getenv ("RC_SOFTLEVEL"))) == NULL) {
/* Ensure our environment is pure /* Ensure our environment is pure
Also, add our configuration to it */ Also, add our configuration to it */
tmplist = env_config (); tmplist = env_config ();
@@ -1066,7 +1066,7 @@ int runscript (int argc, char **argv)
some kernels bitch about this according to the environ man pages some kernels bitch about this according to the environ man pages
so we walk though environ and call unsetenv for each value. */ so we walk though environ and call unsetenv for each value. */
while (environ[0]) { while (environ[0]) {
tmp = strdup (environ[0]); tmp = xstrdup (environ[0]);
p = tmp; p = tmp;
var = strsep (&p, "="); var = strsep (&p, "=");
unsetenv (var); unsetenv (var);
@@ -1144,7 +1144,7 @@ int runscript (int argc, char **argv)
that is being called and not any dependents */ that is being called and not any dependents */
if (getenv ("IN_BACKGROUND")) { if (getenv ("IN_BACKGROUND")) {
in_background = rc_env_bool ("IN_BACKGROUND"); in_background = rc_env_bool ("IN_BACKGROUND");
ibsave = strdup (getenv ("IN_BACKGROUND")); ibsave = xstrdup (getenv ("IN_BACKGROUND"));
unsetenv ("IN_BACKGROUND"); unsetenv ("IN_BACKGROUND");
} }

View File

@@ -593,7 +593,7 @@ int start_stop_daemon (int argc, char **argv)
char *cu = strsep (&p, ":"); char *cu = strsep (&p, ":");
struct passwd *pw = NULL; struct passwd *pw = NULL;
changeuser = strdup (cu); changeuser = xstrdup (cu);
if (sscanf (cu, "%d", &tid) != 1) if (sscanf (cu, "%d", &tid) != 1)
pw = getpwnam (cu); pw = getpwnam (cu);
else else
@@ -886,7 +886,7 @@ int start_stop_daemon (int argc, char **argv)
/* For the path, remove the rcscript bin dir from it */ /* For the path, remove the rcscript bin dir from it */
if (strncmp (env, "PATH=", 5) == 0) { if (strncmp (env, "PATH=", 5) == 0) {
char *path = strdup (env); char *path = xstrdup (env);
char *newpath = NULL; char *newpath = NULL;
char *p = path; char *p = path;
char *token; char *token;