(main,wr_auth) [_WIN32]: switch the default file mode to
binary to match POSIX. Add text mode for auth file.
This commit is contained in:
parent
667b137216
commit
9204e8cf08
1 changed files with 6 additions and 1 deletions
|
@ -40,6 +40,7 @@
|
|||
#if !defined(_WIN32)
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <fcntl.h>
|
||||
#include <direct.h>
|
||||
#include <io.h>
|
||||
#define mkdir(dir,perm) _mkdir(dir)
|
||||
|
@ -87,6 +88,10 @@ main(void)
|
|||
char *cp;
|
||||
char *pathname;
|
||||
|
||||
#if defined(_WIN32)
|
||||
_fmode = _O_BINARY;
|
||||
#endif
|
||||
|
||||
if ((pathname = safe_getcwd()) == NULL) {
|
||||
printf("Can't get current path!\n");
|
||||
exit(-1);
|
||||
|
@ -170,7 +175,7 @@ wrauth(char *filename)
|
|||
FILE *fp;
|
||||
|
||||
printf("Writing %s\n", filename);
|
||||
if ((fp = fopen(filename, "w")) == NULL) {
|
||||
if ((fp = fopen(filename, "wt")) == NULL) {
|
||||
printf("Cannot open %s for writing, exiting.\n", filename);
|
||||
exit(-1);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue