[BusyBox] busybox bugfix - wget
Chip Rosenthal
chip at unicom.com
Thu Sep 14 04:20:54 UTC 2000
There were subtle (minor) problems with "wget -O -". For instance,
"wget -c -O -" was treated differently from "wget -c".
The attached patch should correct the problem. There should be no
side effects from the patch. The correction adds 16 bytes.
text data bss dec hex filename
2223 0 0 2223 8af wget.o
2207 0 0 2207 89f wget.o.orig
--
Chip Rosenthal <chip at unicom.com> http://www.unicom.com/
Protect your mail server against spam. http://mail-abuse.org/
Junk email is theft. There ought to be a law. http://www.cauce.org/
"I can't control my fingers. I can't control my brain."
--- snip snip ----------------------------------------------------------------
Index: wget.c
*** wget.c.orig Mon Sep 4 10:15:55 2000
--- wget.c Wed Sep 13 22:20:31 2000
***************
*** 50,56 ****
++do_continue;
break;
case 'O':
! fname_out = optarg;
break;
default:
usage(wget_usage);
--- 50,56 ----
++do_continue;
break;
case 'O':
! fname_out = (strcmp(optarg, "-") == 0 ? NULL : optarg);
break;
default:
usage(wget_usage);
***************
*** 74,85 ****
* Open the output stream.
*/
if (fname_out != NULL) {
! /* Check if the file is supposed to go to stdout */
! if (!strcmp(fname_out, "-") == 0) {
! /* Nope -- so open the output file */
! if (freopen(fname_out, (do_continue ? "a" : "w"), stdout) == NULL)
! fatalError("wget: freopen(%s): %s\n", fname_out, strerror(errno));
! }
}
/*
--- 74,81 ----
* Open the output stream.
*/
if (fname_out != NULL) {
! if (freopen(fname_out, (do_continue ? "a" : "w"), stdout) == NULL)
! fatalError("wget: freopen(%s): %s\n", fname_out, strerror(errno));
}
/*
***************
*** 248,254 ****
return hdrval;
}
! /* Rat! The buffer isn't big enough to hold the entire header value. */
while (c = getc(fp), c != EOF && c != '\n')
;
*istrunc = 1;
--- 244,250 ----
return hdrval;
}
! /* Rats! The buffer isn't big enough to hold the entire header value. */
while (c = getc(fp), c != EOF && c != '\n')
;
*istrunc = 1;
--- snip snip ----------------------------------------------------------------
More information about the busybox
mailing list