(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:
Ron Koenderink 2004-12-30 14:14:04 +00:00
parent 667b137216
commit 9204e8cf08

View file

@ -40,6 +40,7 @@
#if !defined(_WIN32) #if !defined(_WIN32)
#include <unistd.h> #include <unistd.h>
#else #else
#include <fcntl.h>
#include <direct.h> #include <direct.h>
#include <io.h> #include <io.h>
#define mkdir(dir,perm) _mkdir(dir) #define mkdir(dir,perm) _mkdir(dir)
@ -87,6 +88,10 @@ main(void)
char *cp; char *cp;
char *pathname; char *pathname;
#if defined(_WIN32)
_fmode = _O_BINARY;
#endif
if ((pathname = safe_getcwd()) == NULL) { if ((pathname = safe_getcwd()) == NULL) {
printf("Can't get current path!\n"); printf("Can't get current path!\n");
exit(-1); exit(-1);
@ -170,7 +175,7 @@ wrauth(char *filename)
FILE *fp; FILE *fp;
printf("Writing %s\n", filename); 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); printf("Cannot open %s for writing, exiting.\n", filename);
exit(-1); exit(-1);
} }