diff options
| -rw-r--r-- | src/env-update.c | 12 | ||||
| -rw-r--r-- | src/librc-daemon.c | 18 | ||||
| -rw-r--r-- | src/librc-depend.c | 12 | ||||
| -rw-r--r-- | src/librc-misc.c | 4 | ||||
| -rw-r--r-- | src/librc-strlist.c | 4 | ||||
| -rw-r--r-- | src/librc.c | 36 | ||||
| -rw-r--r-- | src/mountinfo.c | 2 | ||||
| -rw-r--r-- | src/rc-misc.c | 2 | ||||
| -rw-r--r-- | src/rc-plugin.c | 2 | ||||
| -rw-r--r-- | src/rc.c | 10 | ||||
| -rw-r--r-- | src/runscript.c | 10 | ||||
| -rw-r--r-- | src/start-stop-daemon.c | 4 | 
12 files changed, 58 insertions, 58 deletions
| diff --git a/src/env-update.c b/src/env-update.c index e1367c2d..3df8af73 100644 --- a/src/env-update.c +++ b/src/env-update.c @@ -152,7 +152,7 @@ int env_update (int argc, char **argv)  			entries = rc_config_load (path);  			STRLIST_FOREACH (entries, entry, j) { -				char *tmpent = strdup (entry); +				char *tmpent = xstrdup (entry);  				char *value = tmpent;  				char *var = strsep (&value, "="); @@ -176,7 +176,7 @@ int env_update (int argc, char **argv)  		eerrorx ("%s: nothing to process", applet);  	STRLIST_FOREACH (config, entry, i) { -		char *tmpent = strdup (entry); +		char *tmpent = xstrdup (entry);  		char *value = tmpent;  		char *var = strsep (&value, "=");  		char *match; @@ -220,7 +220,7 @@ int env_update (int argc, char **argv)  		}  		STRLIST_FOREACH (envs, env, j) { -			char *tmpenv = strdup (env); +			char *tmpenv = xstrdup (env);  			char *tmpvalue = tmpenv;  			char *tmpentry = strsep (&tmpvalue, "="); @@ -232,7 +232,7 @@ int env_update (int argc, char **argv)  							  "%s%s", colon ? ":" : " ", value);  				} else {  					free (envs[j - 1]); -					envs[j - 1] = strdup (entry); +					envs[j - 1] = xstrdup (entry);  				}  				replaced = true;  			} @@ -256,7 +256,7 @@ int env_update (int argc, char **argv)  	fprintf (fp, NOTICE, "/etc/profile", PROFILE_ENV);  	STRLIST_FOREACH (envs, env, i) { -		char *tmpent = strdup (env); +		char *tmpent = xstrdup (env);  		char *value = tmpent;  		char *var = strsep (&value, "=");  		if (strcmp (var, "LDPATH") != 0) { @@ -274,7 +274,7 @@ int env_update (int argc, char **argv)  	fprintf (fp, NOTICE, "/etc/csh.cshrc", PROFILE_ENV);  	STRLIST_FOREACH (envs, env, i) { -		char *tmpent = strdup (env); +		char *tmpent = xstrdup (env);  		char *value = tmpent;  		char *var = strsep (&value, "=");  		if (strcmp (var, "LDPATH") != 0) { diff --git a/src/librc-daemon.c b/src/librc-daemon.c index ca1a39ef..112f4c9c 100644 --- a/src/librc-daemon.c +++ b/src/librc-daemon.c @@ -304,7 +304,7 @@ bool rc_service_daemon_set (const char *service, const char *exec,  		errno = EINVAL;  		return (false);  	} -	svc = strdup (service); +	svc = xstrdup (service);  	dirpath = rc_strcatpaths (RC_SVCDIR, "daemons",  							  basename (svc), (char *) NULL);  	free (svc); @@ -314,21 +314,21 @@ bool rc_service_daemon_set (const char *service, const char *exec,  		mexec = xmalloc (sizeof (char *) * i);  		snprintf (mexec, i, "exec=%s", exec);  	} else -		mexec = strdup ("exec="); +		mexec = xstrdup ("exec=");  	if (name) {  		i = strlen (name) + 6;  		mname = xmalloc (sizeof (char *) * i);  		snprintf (mname, i, "name=%s", name);  	} else -		mname = strdup ("name="); +		mname = xstrdup ("name=");  	if (pidfile) {  		i = strlen (pidfile) + 9;  		mpidfile = xmalloc (sizeof (char *) * i);  		snprintf (mpidfile, i, "pidfile=%s", pidfile);  	} else -		mpidfile = strdup ("pidfile="); +		mpidfile = xstrdup ("pidfile=");  	/* Regardless, erase any existing daemon info */  	if ((dp = opendir (dirpath))) { @@ -398,7 +398,7 @@ bool rc_service_started_daemon (const char *service, const char *exec,  	if (! service || ! exec)  		return (false); -	svc = strdup (service); +	svc = xstrdup (service);  	dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", basename (svc),  							  (char *) NULL);  	free (svc); @@ -453,7 +453,7 @@ bool rc_service_daemons_crashed (const char *service)  	if (! service)  		return (false); -	svc = strdup (service); +	svc = xstrdup (service);  	dirpath = rc_strcatpaths (RC_SVCDIR, "daemons", basename (svc),  							  (char *) NULL);  	free (svc); @@ -488,15 +488,15 @@ bool rc_service_daemons_crashed (const char *service)  			if (strcmp (token, "exec") == 0) {  				if (exec)  					free (exec); -				exec = strdup (p); +				exec = xstrdup (p);  			} else if (strcmp (token, "name") == 0) {  				if (name)  					free (name); -				name = strdup (p); +				name = xstrdup (p);  			} else if (strcmp (token, "pidfile") == 0) {  				if (pidfile)  					free (pidfile); -				pidfile = strdup (p); +				pidfile = xstrdup (p);  			}  		}  		fclose (fp); diff --git a/src/librc-depend.c b/src/librc-depend.c index 1591eba3..1e4225b8 100644 --- a/src/librc-depend.c +++ b/src/librc-depend.c @@ -110,7 +110,7 @@ rc_depinfo_t *rc_deptree_load (void)  				depinfo = depinfo->next;  			}  			memset (depinfo, 0, sizeof (rc_depinfo_t)); -			depinfo->service = strdup (e); +			depinfo->service = xstrdup (e);  			deptype = NULL;  			continue;  		} @@ -139,7 +139,7 @@ rc_depinfo_t *rc_deptree_load (void)  			}  		if (! deptype->type) -			deptype->type = strdup (type); +			deptype->type = xstrdup (type);  		rc_strlist_addsort (&deptype->services, e);  	} @@ -717,7 +717,7 @@ bool rc_deptree_update (void)  				depinfo = last_depinfo->next;  			}  			memset (depinfo, 0, sizeof (rc_depinfo_t)); -			depinfo->service = strdup (service); +			depinfo->service = xstrdup (service);  		}  		/* We may not have any depends */ @@ -747,7 +747,7 @@ bool rc_deptree_update (void)  					deptype = last_deptype->next;  				}  				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));  					di = last_depinfo->next;  					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;  					}  					memset (dt, 0, sizeof (rc_deptype_t)); -					dt->type = strdup (deppairs[i].addto); +					dt->type = xstrdup (deppairs[i].addto);  				}  				already_added = false; diff --git a/src/librc-misc.c b/src/librc-misc.c index ba0122da..6d90b02c 100644 --- a/src/librc-misc.c +++ b/src/librc-misc.c @@ -120,7 +120,7 @@ char **rc_config_load (const char *file)  		if (! token)  			continue; -		entry = strdup (token); +		entry = xstrdup (token);  		/* Preserve shell coloring */  		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  		   any prior values we may already have */  		STRLIST_FOREACH (list, line, i) { -			char *tmp = strdup (line); +			char *tmp = xstrdup (line);  			linep = tmp;   			linetok = strsep (&linep, "=");  			if (strcmp (linetok, entry) == 0) { diff --git a/src/librc-strlist.c b/src/librc-strlist.c index a9222c68..0f3225e9 100644 --- a/src/librc-strlist.c +++ b/src/librc-strlist.c @@ -27,7 +27,7 @@ static char *_rc_strlist_add (char ***list, const char *item, bool uniq)  	}  	newlist = xrealloc (lst, sizeof (char *) * (i + 2)); -	newlist[i] = strdup (item); +	newlist[i] = xstrdup (item);  	newlist[i + 1] = NULL;  	*list = newlist; @@ -80,7 +80,7 @@ static char *_rc_strlist_addsort (char ***list, const char *item,  		i++;  	tmp1 = newlist[i]; -	retval = newlist[i] = strdup (item); +	retval = newlist[i] = xstrdup (item);  	do {  		i++;  		tmp2 = newlist[i]; diff --git a/src/librc.c b/src/librc.c index 12b3ffa2..3138efc3 100644 --- a/src/librc.c +++ b/src/librc.c @@ -164,13 +164,13 @@ char *rc_runlevel_get (void)  			int i = strlen (buffer) - 1;  			if (buffer[i] == '\n')  				buffer[i] = 0; -			runlevel = strdup (buffer); +			runlevel = xstrdup (buffer);  		}  		fclose (fp);  	}  	if (! runlevel) -		runlevel = strdup (RC_LEVEL_SYSINIT); +		runlevel = xstrdup (RC_LEVEL_SYSINIT);  	return (runlevel);  } @@ -217,7 +217,7 @@ char *rc_service_resolve (const char *service)  		return (NULL);  	if (service[0] == '/') -		return (strdup (service)); +		return (xstrdup (service));  	file = rc_strcatpaths (RC_SVCDIR, "started", service, (char *) NULL);  	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));  		free (file);  		if (r > 0) -			return (strdup (buffer)); +			return (xstrdup (buffer));  	}  	snprintf (buffer, sizeof (buffer), RC_INITDIR "/%s", service); -	return (strdup (buffer)); +	return (xstrdup (buffer));  }  librc_hidden_def(rc_service_resolve) @@ -344,7 +344,7 @@ bool rc_service_in_runlevel (const char *service, const char *runlevel)  	if (! runlevel || ! service)  		return (false); -	svc = strdup (service); +	svc = xstrdup (service);  	file = rc_strcatpaths (RC_RUNLEVELDIR, runlevel, basename (svc),  						   (char *) NULL);  	free (svc); @@ -368,7 +368,7 @@ bool rc_service_mark (const char *service, const rc_service_state_t state)  	if (! service)  		return (false); -	svc = strdup (service); +	svc = xstrdup (service);  	base = basename (svc);  	if (state != RC_SERVICE_STOPPED) { @@ -487,7 +487,7 @@ rc_service_state_t rc_service_state (const char *service)  {  	int i;  	int state = RC_SERVICE_STOPPED; -	char *svc = strdup (service); +	char *svc = xstrdup (service);  	for (i = 0; rc_service_state_names[i].name; i++) {  		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"))) {  		memset (buffer, 0, sizeof (buffer));  		if (fgets (buffer, RC_LINEBUFFER, fp))  -			value = strdup (buffer); +			value = xstrdup (buffer);  		fclose (fp);  	}  	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 */ -	svc = strdup (service); +	svc = xstrdup (service);  	fifo = rc_strcatpaths (RC_SVCDIR, "exclusive", basename (svc),  						   (char *) NULL);  	free (svc); @@ -634,7 +634,7 @@ bool rc_service_schedule_start (const char *service,  	if (! service || ! rc_service_exists (service_to_start))  		return (false); -	svc = strdup (service); +	svc = xstrdup (service);  	dir = rc_strcatpaths (RC_SVCDIR, "scheduled", basename (svc),  						  (char *) NULL);  	free (svc); @@ -644,7 +644,7 @@ bool rc_service_schedule_start (const char *service,  	}  	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);  	free (svc);  	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)  { -	char *svc  = strdup (service); +	char *svc  = xstrdup (service);  	char *dir = rc_strcatpaths (RC_SVCDIR, "scheduled", basename (svc),  								(char *) NULL);  	bool retval; @@ -684,7 +684,7 @@ bool rc_service_wait (const char *service)  	if (! service)  		return (false); -	svc = strdup (service); +	svc = xstrdup (service);  	base = basename (svc);  	fifo = rc_strcatpaths (RC_SVCDIR, "exclusive", base, (char *) NULL);  	/* 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); -	svc = strdup (service); +	svc = xstrdup (service);  	file = rc_strcatpaths (RC_RUNLEVELDIR, runlevel, basename (svc),  						   (char *) NULL);  	free (svc); @@ -809,7 +809,7 @@ bool rc_service_delete (const char *runlevel, const char *service)  	if (! runlevel || ! service)  		return (false); -	svc = strdup (service); +	svc = xstrdup (service);  	file = rc_strcatpaths (RC_RUNLEVELDIR, runlevel, basename (svc),  						   (char *) NULL);  	free (svc); @@ -843,7 +843,7 @@ librc_hidden_def(rc_services_scheduled_by)  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 *) NULL);  	char **list = NULL; @@ -866,7 +866,7 @@ bool rc_service_plugable (char *service)  	if (! match)  		return true; -	list = strdup (match); +	list = xstrdup (match);  	p = list;  	while ((token = strsep (&p, " "))) {  		bool truefalse = true; diff --git a/src/mountinfo.c b/src/mountinfo.c index 25e83ca5..58a70b3e 100644 --- a/src/mountinfo.c +++ b/src/mountinfo.c @@ -173,7 +173,7 @@ static char **find_mounts (struct args *args)  		for (o = optnames; flags && o->o_opt; o++) {  			if (flags & o->o_opt) {  				if (! options) -					options = strdup (o->o_name); +					options = xstrdup (o->o_name);  				else {  					char *tmp = NULL;  					asprintf (&tmp, "%s,%s", options, o->o_name); diff --git a/src/rc-misc.c b/src/rc-misc.c index f3fce324..1215c0c1 100644 --- a/src/rc-misc.c +++ b/src/rc-misc.c @@ -88,7 +88,7 @@ char **env_filter (void)  			/* Now go through the env var and only add bits not in our PREFIX */  			sep = env_var;  			while ((token = strsep (&sep, ":"))) { -				char *np = strdup (PATH_PREFIX); +				char *np = xstrdup (PATH_PREFIX);  				char *npp = np;  				char *tok = NULL;  				while ((tok = strsep (&npp, ":"))) diff --git a/src/rc-plugin.c b/src/rc-plugin.c index b43d4990..8bd50849 100644 --- a/src/rc-plugin.c +++ b/src/rc-plugin.c @@ -91,7 +91,7 @@ void rc_plugin_load (void)  				plugin = plugins = xmalloc (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->hook = fptr;  		} @@ -205,7 +205,7 @@ static int do_e (int argc, char **argv)  	}  	if (message) -		fmt = strdup ("%s"); +		fmt = xstrdup ("%s");  	if (strcmp (applet, "einfo") == 0)   		einfo (fmt, message); @@ -406,7 +406,7 @@ static char *proc_getent (const char *ent)  			p += strlen (ent);  			if (*p == '=')  				p++; -			value = strdup (strsep (&p, " ")); +			value = xstrdup (strsep (&p, " "));  		}  	} else  		errno = ENOENT; @@ -757,7 +757,7 @@ int main (int argc, char **argv)  	atexit (cleanup);  	if (argv[0]) -		applet = strdup (basename (argv[0])); +		applet = xstrdup (basename (argv[0]));  	if (! applet)  		eerrorx ("arguments required"); @@ -858,7 +858,7 @@ int main (int argc, char **argv)  		   some kernels bitch about this according to the environ man pages  		   so we walk though environ and call unsetenv for each value. */  		while (environ[0]) { -			tmp = strdup (environ[0]); +			tmp = xstrdup (environ[0]);  			p = tmp;  			var = strsep (&p, "=");  			unsetenv (var); @@ -1310,7 +1310,7 @@ int main (int argc, char **argv)  	if (newlevel) {  		rc_runlevel_set (newlevel);  		free (runlevel); -		runlevel = strdup (newlevel); +		runlevel = xstrdup (newlevel);  		setenv ("RC_SOFTLEVEL", runlevel, 1);  	} diff --git a/src/runscript.c b/src/runscript.c index e95fc5b0..2c49742a 100644 --- a/src/runscript.c +++ b/src/runscript.c @@ -1009,7 +1009,7 @@ int runscript (int argc, char **argv)  	/* We need the full path to the service */  	if (*argv[1] == '/') -		service = strdup (argv[1]); +		service = xstrdup (argv[1]);  	else {  		char 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);  	} -	applet = strdup (basename (service)); +	applet = xstrdup (basename (service));  	atexit (cleanup);  	/* 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 -	if ((softlevel = strdup (getenv ("RC_SOFTLEVEL"))) == NULL) { +	if ((softlevel = xstrdup (getenv ("RC_SOFTLEVEL"))) == NULL) {  		/* Ensure our environment is pure  		   Also, add our configuration to it */  		tmplist = env_config (); @@ -1066,7 +1066,7 @@ int runscript (int argc, char **argv)  			   some kernels bitch about this according to the environ man pages  			   so we walk though environ and call unsetenv for each value. */  			while (environ[0]) { -				tmp = strdup (environ[0]); +				tmp = xstrdup (environ[0]);  				p = tmp;  				var = strsep (&p, "=");  				unsetenv (var); @@ -1144,7 +1144,7 @@ int runscript (int argc, char **argv)  	   that is being called and not any dependents */  	if (getenv ("IN_BACKGROUND")) {  		in_background = rc_env_bool ("IN_BACKGROUND"); -		ibsave = strdup (getenv ("IN_BACKGROUND")); +		ibsave = xstrdup (getenv ("IN_BACKGROUND"));  		unsetenv ("IN_BACKGROUND");  	} diff --git a/src/start-stop-daemon.c b/src/start-stop-daemon.c index 4d6dff44..0b7c94fe 100644 --- a/src/start-stop-daemon.c +++ b/src/start-stop-daemon.c @@ -593,7 +593,7 @@ int start_stop_daemon (int argc, char **argv)  					char *cu = strsep (&p, ":");  					struct passwd *pw = NULL; -					changeuser = strdup (cu); +					changeuser = xstrdup (cu);  					if (sscanf (cu, "%d", &tid) != 1)  						pw = getpwnam (cu);  					else @@ -886,7 +886,7 @@ int start_stop_daemon (int argc, char **argv)  			/* For the path, remove the rcscript bin dir from it */  			if (strncmp (env, "PATH=", 5) == 0) { -				char *path = strdup (env); +				char *path = xstrdup (env);  				char *newpath = NULL;  				char *p = path;  				char *token; | 
