Skip to content

Commit bcd43d5

Browse files
Moved O_BINARY handling to the one place it is used.
1 parent 8540f32 commit bcd43d5

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

libnvme/src/platform/linux.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,5 @@ typedef int libnvme_fd_t;
1212
#define TEST_FD 0xFD
1313
#define INIT_FD -1
1414

15-
/* O_BINARY is required on Windows, but not defined on Linux. */
16-
#ifndef O_BINARY
17-
#define O_BINARY 0
18-
#endif
19-
2015
/* Platform initialization - no-op on Linux */
2116
static inline void libnvme_init(void) {}

plugins/ocp/ocp-nvme.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,11 @@ static int get_telemetry_log_page_data(struct libnvme_transport_handle *hdl,
11881188
}
11891189
memset(hdr, 0, bs);
11901190

1191+
#ifdef O_BINARY /* required for Windows, not defined on Linux */
11911192
fd = open(output_file, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666);
1193+
#else
1194+
fd = open(output_file, O_WRONLY | O_CREAT | O_TRUNC, 0666);
1195+
#endif
11921196
if (fd < 0) {
11931197
fprintf(stderr, "Failed to open output file %s: %s!\n",
11941198
output_file, libnvme_strerror(errno));

0 commit comments

Comments
 (0)