diff options
author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-07-19 22:28:02 +0000 |
---|---|---|
committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-07-19 22:28:02 +0000 |
commit | d997e48ccc3987112bc58387f78d4727559d66f5 (patch) | |
tree | f7822e652f54884459d525f57f1ef18c03a126f7 /uudecode.c | |
parent | 43422b1ad537cdb32cb2c6474135cc2ac4ef297b (diff) | |
download | busybox-w32-d997e48ccc3987112bc58387f78d4727559d66f5.tar.gz busybox-w32-d997e48ccc3987112bc58387f78d4727559d66f5.tar.bz2 busybox-w32-d997e48ccc3987112bc58387f78d4727559d66f5.zip |
Some adjustments, mostly from David McCullough <davidm@lineo.com> to
make busybox be more uClinux friendly. I also adjusted Config.h for
uClinux so it will automagically disable apps the arn't going to
work without fork() and such.
-Erik
git-svn-id: svn://busybox.net/trunk/busybox@3130 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'uudecode.c')
-rw-r--r-- | uudecode.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/uudecode.c b/uudecode.c index 6a3f78a42..6ac9f1bf3 100644 --- a/uudecode.c +++ b/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 | ||
277 | int uudecode_main (int argc, | 286 | int uudecode_main (int argc, |