aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/ls.c2
-rw-r--r--coreutils/uudecode.c15
2 files changed, 14 insertions, 3 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c
index bd79cc940..10191476e 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -303,6 +303,7 @@ static struct dnode **dnalloc(int num)
303 return(p); 303 return(p);
304} 304}
305 305
306#ifdef BB_FEATURE_LS_RECURSIVE
306static void dfree(struct dnode **dnp) 307static void dfree(struct dnode **dnp)
307{ 308{
308 struct dnode *cur, *next; 309 struct dnode *cur, *next;
@@ -318,6 +319,7 @@ static void dfree(struct dnode **dnp)
318 } 319 }
319 free(dnp); /* free the array holding the dnode pointers */ 320 free(dnp); /* free the array holding the dnode pointers */
320} 321}
322#endif
321 323
322static struct dnode **splitdnarray(struct dnode **dn, int nfiles, int which) 324static struct dnode **splitdnarray(struct dnode **dn, int nfiles, int which)
323{ 325{
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c
index 6a3f78a42..6ac9f1bf3 100644
--- a/coreutils/uudecode.c
+++ b/coreutils/uudecode.c
@@ -207,6 +207,8 @@ static int decode (const char *inname,
207 char buf[2 * BUFSIZ]; 207 char buf[2 * BUFSIZ];
208 char *outname; 208 char *outname;
209 int do_base64 = 0; 209 int do_base64 = 0;
210 int res;
211 int dofre;
210 212
211 /* Search for header line. */ 213 /* Search for header line. */
212 214
@@ -226,6 +228,7 @@ static int decode (const char *inname,
226 } 228 }
227 229
228 /* If the output file name is given on the command line this rules. */ 230 /* If the output file name is given on the command line this rules. */
231 dofre = FALSE;
229 if (forced_outname != NULL) 232 if (forced_outname != NULL)
230 outname = (char *) forced_outname; 233 outname = (char *) forced_outname;
231 else { 234 else {
@@ -248,10 +251,11 @@ static int decode (const char *inname,
248 } 251 }
249 n = strlen (pw->pw_dir); 252 n = strlen (pw->pw_dir);
250 n1 = strlen (p); 253 n1 = strlen (p);
251 outname = (char *) alloca ((size_t) (n + n1 + 2)); 254 outname = (char *) xmalloc ((size_t) (n + n1 + 2));
252 memcpy (outname + n + 1, p, (size_t) (n1 + 1)); 255 memcpy (outname + n + 1, p, (size_t) (n1 + 1));
253 memcpy (outname, pw->pw_dir, (size_t) n); 256 memcpy (outname, pw->pw_dir, (size_t) n);
254 outname[n] = '/'; 257 outname[n] = '/';
258 dofre = TRUE;
255 } 259 }
256 } 260 }
257 261
@@ -261,6 +265,8 @@ static int decode (const char *inname,
261 || chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO)) 265 || chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO))
262 )) { 266 )) {
263 perror_msg("%s", outname); /* */ 267 perror_msg("%s", outname); /* */
268 if (dofre)
269 free(outname);
264 return FALSE; 270 return FALSE;
265 } 271 }
266 272
@@ -269,9 +275,12 @@ static int decode (const char *inname,
269 275
270 /* For each input line: */ 276 /* For each input line: */
271 if (do_base64) 277 if (do_base64)
272 return read_base64 (inname); 278 res = read_base64 (inname);
273 else 279 else
274 return read_stduu (inname); 280 res = read_stduu (inname);
281 if (dofre)
282 free(outname);
283 return res;
275} 284}
276 285
277int uudecode_main (int argc, 286int uudecode_main (int argc,