Skip to content

Commit fe8f2ce

Browse files
committed
Remove references to O_BINARY
Signed-off-by: Jo-Philipp Wich <[email protected]>
1 parent fe3bfde commit fe8f2ce

File tree

3 files changed

+4
-20
lines changed

3 files changed

+4
-20
lines changed

libsparse/output_file.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <stddef.h>
2525
#include <stdlib.h>
2626
#include <string.h>
27+
#include <sys/mman.h>
2728
#include <sys/stat.h>
2829
#include <sys/types.h>
2930
#include <unistd.h>
@@ -34,13 +35,6 @@
3435
#include "sparse_crc32.h"
3536
#include "sparse_format.h"
3637

37-
#ifndef USE_MINGW
38-
#include <sys/mman.h>
39-
#define O_BINARY 0
40-
#else
41-
#define ftruncate64 ftruncate
42-
#endif
43-
4438
#if defined(__APPLE__) && defined(__MACH__)
4539
#define lseek64 lseek
4640
#define ftruncate64 ftruncate
@@ -748,7 +742,7 @@ int write_file_chunk(struct output_file *out, unsigned int len,
748742
{
749743
int ret;
750744

751-
int file_fd = open(file, O_RDONLY | O_BINARY);
745+
int file_fd = open(file, O_RDONLY);
752746
if (file_fd < 0) {
753747
return -errno;
754748
}

make_ext4fs.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@
3535
#include <sys/stat.h>
3636
#include <sys/types.h>
3737

38-
#ifndef USE_MINGW
39-
40-
#define O_BINARY 0
41-
42-
#endif
43-
4438
/* TODO: Not implemented:
4539
Allocating blocks in the same block group as the file inode
4640
Hash or binary tree directories
@@ -364,7 +358,7 @@ int make_ext4fs(const char *filename, long long len,
364358
reset_ext4fs_info();
365359
info.len = len;
366360

367-
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
361+
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644);
368362
if (fd < 0) {
369363
error_errno("open");
370364
return EXIT_FAILURE;

make_ext4fs_main.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@
3333
#include "ext4_utils.h"
3434
#include "canned_fs_config.h"
3535

36-
#ifndef USE_MINGW /* O_BINARY is windows-specific flag */
37-
#define O_BINARY 0
38-
#endif
39-
4036
extern struct fs_info info;
4137

4238

@@ -181,7 +177,7 @@ int main(int argc, char **argv)
181177
}
182178

183179
if (strcmp(filename, "-")) {
184-
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644);
180+
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644);
185181
if (fd < 0) {
186182
perror("open");
187183
return EXIT_FAILURE;

0 commit comments

Comments
 (0)