diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-24 22:02:01 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-24 22:02:01 +0000 |
commit | 218f2f4882482e1d023ddbf4b9f6cbf1f6b0145d (patch) | |
tree | e58717abf91e17db281fbbdfdc0072c198ce85b7 /libbb/xfuncs.c | |
parent | 84d2d493b4b664d1465cff955367fb9bc7769e5d (diff) | |
download | busybox-w32-218f2f4882482e1d023ddbf4b9f6cbf1f6b0145d.tar.gz busybox-w32-218f2f4882482e1d023ddbf4b9f6cbf1f6b0145d.tar.bz2 busybox-w32-218f2f4882482e1d023ddbf4b9f6cbf1f6b0145d.zip |
accumulated post-1.4.0 fixes
Diffstat (limited to 'libbb/xfuncs.c')
-rw-r--r-- | libbb/xfuncs.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index 4252e7646..f6b904f78 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c | |||
@@ -81,13 +81,14 @@ char * xstrndup(const char *s, int n) | |||
81 | t = (char*) s; | 81 | t = (char*) s; |
82 | while (m) { | 82 | while (m) { |
83 | if (!*t) break; | 83 | if (!*t) break; |
84 | m--; t++; | 84 | m--; |
85 | t++; | ||
85 | } | 86 | } |
86 | n = n - m; | 87 | n -= m; |
87 | t = xmalloc(n + 1); | 88 | t = xmalloc(n + 1); |
88 | t[n] = '\0'; | 89 | t[n] = '\0'; |
89 | 90 | ||
90 | return memcpy(t,s,n); | 91 | return memcpy(t, s, n); |
91 | } | 92 | } |
92 | 93 | ||
93 | // Die if we can't open a file and return a FILE * to it. | 94 | // Die if we can't open a file and return a FILE * to it. |