Unverified Commit 996287e2 authored by Jia Zhouyang's avatar Jia Zhouyang Committed by GitHub

Add error handling code for fopen

Check the return value of fopen, and add proper error handling code.
parent e0d419f0
......@@ -611,9 +611,11 @@ readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu)
FILE *ff;
ff = fopen(w3m_reqlog, "a");
Strfputs(tmp, ff);
if (src)
Strfputs(tmp, src);
cleanup_line(tmp, HEADER_MODE);
......@@ -7580,6 +7582,8 @@ loadImageBuffer(URLFile *uf, Buffer *newBuf)
tmp = Sprintf("<img src=\"%s\"><br><br>", html_quote(image.url));
tmpf = tmpfname(TMPF_SRC, ".html");
src = fopen(tmpf->ptr, "w");
if (src == NULL)
return NULL;
newBuf->mailcap_source = tmpf->ptr;
init_stream(&f, SCM_LOCAL, newStrStream(tmp));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment