Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@
#include <stdlib.h>
#include <string.h>

//Includes from POSIX:
#include <unistd.h>
#ifdef __unix__
#include <unistd.h>
#endif

// Constants R_OK and W_OK in windows not defined => redefinition here
#define READ_PERM 0x02
#define WRITE_PERM 0x04

//Constants:
#define BITMAP_MAGIC_NUMBER 0x4D42
Expand Down Expand Up @@ -1652,7 +1657,7 @@ bitmap_error_t bitmapCreateFile(bitmap_t* bitmap, const char* filePath, bitmap_b
bitmapLog(BITMAP_LOGGING_VERBOSE, "Going to create file \"%s\" ...", filePath);

//Check the access to the file path:
if (access(filePath, R_OK | W_OK) == 0)
if (access(filePath, READ_PERM | WRITE_PERM) == 0)
{
//The file already exists. Is that allowed?
if (!overwriteExisting)
Expand Down