Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build on latest musl #34

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ IF(DEFINE_WIN)
add_definitions(-D__WIN__)
ENDIF(DEFINE_WIN)

add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64)

include_directories("${CMAKE_SOURCE_DIR}/src")

add_executable(fatcat "src/fatcat.cpp" ${ALL_SOURCES})
Expand Down
4 changes: 2 additions & 2 deletions src/core/FatSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ int FatSystem::readData(unsigned long long address, char *buffer, int size)
cerr << "! Trying to read outside the disk" << endl;
}

lseek64(fd, globalOffset+address, SEEK_SET);
lseek(fd, globalOffset+address, SEEK_SET);

int n;
int pos = 0;
Expand All @@ -112,7 +112,7 @@ int FatSystem::writeData(unsigned long long address, const char *buffer, int siz
throw string("Trying to write data while write mode is disabled");
}

lseek64(fd, globalOffset+address, SEEK_SET);
lseek(fd, globalOffset+address, SEEK_SET);

int n;
int pos = 0;
Expand Down
2 changes: 0 additions & 2 deletions src/core/FatSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@

#ifdef __APPLE__
#define O_LARGEFILE 0
#define lseek64 lseek
#endif
#ifdef __WIN__
#define O_LARGEFILE 0
#define lseek64 lseek
#endif
using namespace std;

Expand Down
8 changes: 2 additions & 6 deletions src/fatcat.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
#include <stdlib.h>
#include<string.h>
#ifdef __APPLE__
#include <unistd.h>
#else
#include <string.h>
#ifdef __WIN__
#include <ctype.h>
#include "xgetopt/xgetopt.h"
#else
#include <argp.h>
#endif
#include <unistd.h>
#endif

#include <stdio.h>
Expand Down