Add error handling code for fopen
Check the return value of fopen, and add proper error handling code.
This commit is contained in:
@@ -611,9 +611,11 @@ readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu)
|
|||||||
if(w3m_reqlog){
|
if(w3m_reqlog){
|
||||||
FILE *ff;
|
FILE *ff;
|
||||||
ff = fopen(w3m_reqlog, "a");
|
ff = fopen(w3m_reqlog, "a");
|
||||||
|
if(ff){
|
||||||
Strfputs(tmp, ff);
|
Strfputs(tmp, ff);
|
||||||
fclose(ff);
|
fclose(ff);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (src)
|
if (src)
|
||||||
Strfputs(tmp, src);
|
Strfputs(tmp, src);
|
||||||
cleanup_line(tmp, HEADER_MODE);
|
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));
|
tmp = Sprintf("<img src=\"%s\"><br><br>", html_quote(image.url));
|
||||||
tmpf = tmpfname(TMPF_SRC, ".html");
|
tmpf = tmpfname(TMPF_SRC, ".html");
|
||||||
src = fopen(tmpf->ptr, "w");
|
src = fopen(tmpf->ptr, "w");
|
||||||
|
if (src == NULL)
|
||||||
|
return NULL;
|
||||||
newBuf->mailcap_source = tmpf->ptr;
|
newBuf->mailcap_source = tmpf->ptr;
|
||||||
|
|
||||||
init_stream(&f, SCM_LOCAL, newStrStream(tmp));
|
init_stream(&f, SCM_LOCAL, newStrStream(tmp));
|
||||||
|
|||||||
Reference in New Issue
Block a user