diff -r 75d4b6a55593 -r b7d55f3fa183 main.c --- a/main.c Mon Apr 07 21:29:21 2008 -0400 +++ b/main.c Mon Apr 07 21:32:19 2008 -0400 @@ -267,6 +267,11 @@ if (stat(file, &buf) < 0) { fp = fopen(file, "w"); + if (fp == NULL) { + fprintf(stderr, + "failed to open %s for writing\n", file); + return -1; + } curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp); curl_easy_setopt(curl, CURLOPT_URL, url); res = curl_easy_perform(curl);