Skip to content

Commit

Permalink
win32 updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tjko committed Jan 24, 2025
1 parent 93fa6d5 commit 2cfe1f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
7 changes: 6 additions & 1 deletion misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ FILE* create_file(const char *name)
if (!name)
return NULL;

if ((fd = creat(name, S_IWUSR | S_IRUSR)) < 0)
#ifdef WIN32
fd = open(name, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, _S_IREAD | _S_IWRITE);
#else
fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR);
#endif
if (fd < 0)
return NULL;
if (!(f = fdopen(fd, "wb"))) {
close(fd);
Expand Down
8 changes: 0 additions & 8 deletions win32_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@ extern "C" {
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
#endif

#ifndef S_IRUSR
#define S_IRUSR _S_IREAD
#endif

#ifndef S_IWUSR
#define S_IWUSR _S_IWRITE
#endif

#ifndef HOST_TYPE
#if _WIN64
#define HOST_TYPE "Win64"
Expand Down

0 comments on commit 2cfe1f0

Please sign in to comment.