Add error handling code for fopen
Check the return code of fopen, and return when it fails.
This commit is contained in:
4
url.c
4
url.c
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user