aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2015-08-04 09:46:24 +0100
committerRon Yorston <rmy@pobox.com>2015-08-04 09:46:24 +0100
commit64fde14d12cc5e6182f114ecaf4340ec1854c2f6 (patch)
tree4d2cabca7865dd74e2344834d89503c534fb502c /libbb
parent7aabb625005c642d6a30d6d97b51bf183429152e (diff)
parent16aa7a73c40ba5dfaabaedb8a5533619cb8b6cb6 (diff)
downloadbusybox-w32-64fde14d12cc5e6182f114ecaf4340ec1854c2f6.tar.gz
busybox-w32-64fde14d12cc5e6182f114ecaf4340ec1854c2f6.tar.bz2
busybox-w32-64fde14d12cc5e6182f114ecaf4340ec1854c2f6.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'libbb')
-rw-r--r--libbb/procps.c3
-rw-r--r--libbb/xfuncs_printf.c5
2 files changed, 6 insertions, 2 deletions
diff --git a/libbb/procps.c b/libbb/procps.c
index b597b74f9..32dae43e3 100644
--- a/libbb/procps.c
+++ b/libbb/procps.c
@@ -555,8 +555,7 @@ procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags)
555 break; 555 break;
556 if (flags & PSSCAN_ARGVN) { 556 if (flags & PSSCAN_ARGVN) {
557 sp->argv_len = n; 557 sp->argv_len = n;
558 sp->argv0 = xmalloc(n + 1); 558 sp->argv0 = xmemdup(buf, n + 1);
559 memcpy(sp->argv0, buf, n + 1);
560 /* sp->argv0[n] = '\0'; - buf has it */ 559 /* sp->argv0[n] = '\0'; - buf has it */
561 } else { 560 } else {
562 sp->argv_len = 0; 561 sp->argv_len = 0;
diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c
index e4ac6a002..73488908d 100644
--- a/libbb/xfuncs_printf.c
+++ b/libbb/xfuncs_printf.c
@@ -112,6 +112,11 @@ char* FAST_FUNC xstrndup(const char *s, int n)
112 return memcpy(t, s, n); 112 return memcpy(t, s, n);
113} 113}
114 114
115void* FAST_FUNC xmemdup(const void *s, int n)
116{
117 return memcpy(xmalloc(n), s, n);
118}
119
115// Die if we can't open a file and return a FILE* to it. 120// Die if we can't open a file and return a FILE* to it.
116// Notice we haven't got xfread(), This is for use with fscanf() and friends. 121// Notice we haven't got xfread(), This is for use with fscanf() and friends.
117FILE* FAST_FUNC xfopen(const char *path, const char *mode) 122FILE* FAST_FUNC xfopen(const char *path, const char *mode)