Skip to content

Commit 51f64ed

Browse files
authored
ipcs: ftruncate is not support on WIN32 (#424)
microsoft/WSL#902
1 parent a52d912 commit 51f64ed

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/unix.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,15 @@ qb_sys_mmap_file_open(char *path, const char *file, size_t bytes,
111111
return res;
112112
}
113113

114+
#ifndef _WIN32
115+
/* ftruncate not supported on WSL
116+
https://github.com/microsoft/WSL/issues/902 */
114117
if (ftruncate(fd, bytes) == -1) {
115118
res = -errno;
116119
qb_util_perror(LOG_ERR, "couldn't truncate file %s", path);
117120
goto unlink_exit;
118121
}
119-
122+
#endif
120123
#ifdef HAVE_POSIX_FALLOCATE
121124
if ((res = posix_fallocate(fd, 0, bytes)) != 0) {
122125
errno = res;

0 commit comments

Comments
 (0)