summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2009-01-12 08:31:03 +0000
committerRoy Marples <roy@marples.name>2009-01-12 08:31:03 +0000
commit8a9a2d5fe9bbb80381f54da16460f1578f367be5 (patch)
tree2dcbfd63b7a8e47c060f314cb090a040ce0037a3 /src
parenta33554ab18a58a59628d777b7a5268882869b35c (diff)
downloadopenrc-8a9a2d5fe9bbb80381f54da16460f1578f367be5.tar.gz
openrc-8a9a2d5fe9bbb80381f54da16460f1578f367be5.tar.bz2
openrc-8a9a2d5fe9bbb80381f54da16460f1578f367be5.tar.xz
Use snprintf instead of strlcpy to save on size if not available.
Diffstat (limited to 'src')
-rw-r--r--src/includes/rc-misc.h8
-rw-r--r--src/librc/librc-daemon.c23
2 files changed, 7 insertions, 24 deletions
diff --git a/src/includes/rc-misc.h b/src/includes/rc-misc.h
index e0cfde7..113662f 100644
--- a/src/includes/rc-misc.h
+++ b/src/includes/rc-misc.h
@@ -4,7 +4,7 @@
*/
/*
- * Copyright 2007-2008 Roy Marples <roy@marples.name>
+ * Copyright 2007-2009 Roy Marples <roy@marples.name>
* All rights reserved
* Redistribution and use in source and binary forms, with or without
@@ -41,6 +41,7 @@
#define RC_LEVEL_DEFAULT "default"
#define RC_DEPTREE_CACHE RC_SVCDIR "/deptree"
+#define RC_DEPTREE_SKEWED RC_SVCDIR "/clock-skewed"
#define RC_KRUNLEVEL RC_SVCDIR "/krunlevel"
#define RC_STARTING RC_SVCDIR "/rc.starting"
#define RC_STOPPING RC_SVCDIR "/rc.stopping"
@@ -84,6 +85,11 @@
(var) = (tvar))
#endif
+#ifdef __GLIBC__
+# if ! defined (__UCLIBC__) && ! defined (__dietlibc__)
+# define strlcpy(dst, src, size) snprintf(dst, size, "%s", src)
+# endif
+#endif
_unused static void *xmalloc (size_t size)
{
diff --git a/src/librc/librc-daemon.c b/src/librc/librc-daemon.c
index f2c1b44..c3cdd86 100644
--- a/src/librc/librc-daemon.c
+++ b/src/librc/librc-daemon.c
@@ -31,29 +31,6 @@
#include "librc.h"
-#ifdef __GLIBC__
-# if ! defined (__UCLIBC__) && ! defined (__dietlibc__)
-static size_t strlcpy(char *dst, const char *src, size_t size)
-{
- const char *s = src;
- size_t n = size;
-
- if (n && --n)
- do {
- if (!(*dst++ = *src++))
- break;
- } while (--n);
-
- if (!n) {
- if (size)
- *dst = '\0';
- while (*src++);
- }
-
- return src - s - 1;
-}
-# endif
-#endif
#if defined(__linux__)