aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-07-06 17:07:29 +0000
committerRoy Marples <roy@marples.name>2007-07-06 17:07:29 +0000
commit913b3b1f6baf1fefed9a0d2c5d1cdefa2c8cef8f (patch)
tree0954c14e97890ccd4a78384fa62bcfd3ca50af1b /src
parent809b5286b65b5f74c9968925546f11857e6dc36a (diff)
Of course, glibc does not have strlcpy
Diffstat (limited to 'src')
-rw-r--r--src/runscript.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/runscript.c b/src/runscript.c
index dd0acb37..b17aede7 100644
--- a/src/runscript.c
+++ b/src/runscript.c
@@ -1080,22 +1080,23 @@ int main (int argc, char **argv)
/* eprefix is kinda klunky, but it works for our purposes */
if (rc_is_env ("RC_PREFIX", "yes")) {
int l = 0;
+ int ll;
char *svc;
/* Get the longest service name */
services = rc_services_in_runlevel (NULL);
STRLIST_FOREACH (services, svc, i) {
- int ll = strlen (svc);
+ ll = strlen (svc);
if (ll > l)
l = ll;
}
- // rc_strlist_free (services);
-
- svc = prefix = rc_xmalloc (sizeof (char *) * l);
- svc += strlcpy (prefix, applet, l);
- i = l - strlen (prefix);
- memset (svc, ' ', i);
- memset (svc + i, 0, 1);
+
+ /* Make our prefix string */
+ prefix = rc_xmalloc (sizeof (char *) * l);
+ ll = strlen (applet);
+ memcpy (prefix, applet, ll);
+ memset (prefix + ll, ' ', l - ll);
+ memset (prefix + l, 0, 1);
eprefix (prefix);
}