Patch from Vladimir N. Oleynik to simplify wget file opening

using xfopen (which is what everything should be using).
This commit is contained in:
Eric Andersen 2001-01-31 17:49:47 +00:00
parent 65225df2dc
commit 79e898ac0e
2 changed files with 4 additions and 6 deletions

View file

@ -167,8 +167,7 @@ int wget_main(int argc, char **argv)
* Open the output file stream. * Open the output file stream.
*/ */
if (fname_out != (char *)1) { if (fname_out != (char *)1) {
if ( (output=fopen(fname_out, (do_continue ? "a" : "w"))) == NULL) output = xfopen( fname_out, (do_continue ? "a" : "w") );
perror_msg_and_die("fopen(%s)", fname_out);
} else { } else {
output = stdout; output = stdout;
} }
@ -533,7 +532,7 @@ progressmeter(int flag)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: wget.c,v 1.23 2001/01/27 08:24:38 andersen Exp $ * $Id: wget.c,v 1.24 2001/01/31 17:49:47 andersen Exp $
*/ */

5
wget.c
View file

@ -167,8 +167,7 @@ int wget_main(int argc, char **argv)
* Open the output file stream. * Open the output file stream.
*/ */
if (fname_out != (char *)1) { if (fname_out != (char *)1) {
if ( (output=fopen(fname_out, (do_continue ? "a" : "w"))) == NULL) output = xfopen( fname_out, (do_continue ? "a" : "w") );
perror_msg_and_die("fopen(%s)", fname_out);
} else { } else {
output = stdout; output = stdout;
} }
@ -533,7 +532,7 @@ progressmeter(int flag)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: wget.c,v 1.23 2001/01/27 08:24:38 andersen Exp $ * $Id: wget.c,v 1.24 2001/01/31 17:49:47 andersen Exp $
*/ */