Unverified Commit 7a49f77b authored by Jia Zhouyang's avatar Jia Zhouyang Committed by GitHub

Add error handling code for fopen

Check the return code of fopen, and return when it fails.
parent 996287e2
......@@ -1752,6 +1752,8 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current,
write(sock, tmp->ptr, tmp->length);
if(w3m_reqlog){
FILE *ff = fopen(w3m_reqlog, "a");
if (ff == NULL)
return uf;
if (sslh)
fputs("HTTPS: request via SSL\n", ff);
else
......@@ -1774,6 +1776,8 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current,
write(sock, tmp->ptr, tmp->length);
if(w3m_reqlog){
FILE *ff = fopen(w3m_reqlog, "a");
if (ff == NULL)
return uf;
fwrite(tmp->ptr, sizeof(char), tmp->length, ff);
fclose(ff);
}
......
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