part_name = swm_base_name;
}
- part_fd = topen(part_name, O_WRONLY);
- if (part_fd == INVALID_FILEDES) {
+ part_fd = topen(part_name, O_WRONLY | O_BINARY);
+ if (part_fd == -1) {
ERROR_WITH_ERRNO("Failed to open `%"TS"'", part_name);
ret = WIMLIB_ERR_OPEN;
goto out;