diff options
author | Jay Satiro <raysatiro@yahoo.com> | 2015-06-01 03:20:18 -0400 |
---|---|---|
committer | Jay Satiro <raysatiro@yahoo.com> | 2015-06-01 03:21:23 -0400 |
commit | e8423f9ce1507c749c559f1ac1847fa433e66c45 (patch) | |
tree | e8596020f27127160bfeedd51ecbc6b95da2c4d5 /src/tool_parsecfg.c | |
parent | 9f5dcab83d77b2331ed2716f901e5cb4a0c17529 (diff) | |
download | curl-e8423f9ce1507c749c559f1ac1847fa433e66c45.tar.gz |
curl_setup: Add macros for FOPEN_READTEXT, FOPEN_WRITETEXT
- Change fopen calls to use FOPEN_READTEXT instead of "r" or "rt"
- Change fopen calls to use FOPEN_WRITETEXT instead of "w" or "wt"
This change is to explicitly specify when we need to read/write text.
Unfortunately 't' is not part of POSIX fopen so we can't specify it
directly. Instead we now have FOPEN_READTEXT, FOPEN_WRITETEXT.
Prior to this change we had an issue on Windows if an application that
uses libcurl overrides the default file mode to binary. The default file
mode in Windows is normally text mode (translation mode) and that's what
libcurl expects.
Bug: https://github.com/bagder/curl/pull/258#issuecomment-107093055
Reported-by: Orgad Shaneh
Diffstat (limited to 'src/tool_parsecfg.c')
-rw-r--r-- | src/tool_parsecfg.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tool_parsecfg.c b/src/tool_parsecfg.c index 4c25ddbd5..39b43eef4 100644 --- a/src/tool_parsecfg.c +++ b/src/tool_parsecfg.c @@ -69,7 +69,7 @@ int parseconfig(const char *filename, struct GlobalConfig *global) /* Check if the file exists - if not, try CURLRC in the same * directory as our executable */ - file = fopen(filebuffer, "r"); + file = fopen(filebuffer, FOPEN_READTEXT); if(file != NULL) { fclose(file); filename = filebuffer; @@ -115,7 +115,7 @@ int parseconfig(const char *filename, struct GlobalConfig *global) } if(strcmp(filename, "-")) - file = fopen(filename, "r"); + file = fopen(filename, FOPEN_READTEXT); else file = stdin; |