From b3a9da279b1083b68bf55be48332c80c0df658b0 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 22 Jan 2001 22:48:22 +0000 Subject: [PATCH] check for an error openning the download file (this is what I intended to commit previously, but wasn't finished) --- source/cl_main.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/cl_main.c b/source/cl_main.c index 02b2a26..13dd780 100644 --- a/source/cl_main.c +++ b/source/cl_main.c @@ -36,6 +36,7 @@ # include #endif +#include #include #include #ifdef HAVE_NETINET_IN_H @@ -1138,10 +1139,15 @@ CL_Download_f (void) strncpy (cls.downloadtempname, cls.downloadname, sizeof (cls.downloadtempname)); cls.download = Qopen (cls.downloadname, "wb"); - cls.downloadtype = dl_single; + if (cls.download) { + cls.downloadtype = dl_single; - MSG_WriteByte (&cls.netchan.message, clc_stringcmd); - SZ_Print (&cls.netchan.message, va ("download %s\n", Cmd_Argv (1))); + MSG_WriteByte (&cls.netchan.message, clc_stringcmd); + SZ_Print (&cls.netchan.message, va ("download %s\n", Cmd_Argv (1))); + } else { + Con_Printf ("error downloading %s: %s\n", Cmd_Argv (1), + strerror (errno)); + } } #ifdef _WIN32