aboutsummaryrefslogtreecommitdiff
path: root/utility.c
diff options
context:
space:
mode:
Diffstat (limited to 'utility.c')
-rw-r--r--utility.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/utility.c b/utility.c
index ef52ce2f7..46907e46a 100644
--- a/utility.c
+++ b/utility.c
@@ -1456,6 +1456,36 @@ extern void *xmalloc(size_t size)
return cp;
}
+#if defined BB_FEATURE_NFSMOUNT
+extern char * xstrdup (const char *s) {
+ char *t;
+
+ if (s == NULL)
+ return NULL;
+
+ t = strdup (s);
+
+ if (t == NULL)
+ fatalError(memory_exhausted, "");
+
+ return t;
+}
+
+extern char * xstrndup (const char *s, int n) {
+ char *t;
+
+ if (s == NULL)
+ fatalError("xstrndup bug");
+
+ t = xmalloc(n+1);
+ strncpy(t,s,n);
+ t[n] = 0;
+
+ return t;
+}
+#endif
+
+
#if (__GLIBC__ < 2) && (defined BB_SYSLOGD || defined BB_INIT)
extern int vdprintf(int d, const char *format, va_list ap)
{