Skip to content

Commit 1033d24

Browse files
authored
Merge pull request #5957 from mvieth/openbsd_ftruncate
Add special implementation for raw_fallocate for OpenBSD
2 parents f04c4b9 + 5d71435 commit 1033d24

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

io/include/pcl/io/low_level_io.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,12 @@ namespace pcl
181181
// All other errors are passed up.
182182
if (errno != EINVAL)
183183
return -1;
184+
# elif defined(__OpenBSD__)
185+
// OpenBSD has neither posix_fallocate nor fallocate
186+
if (::ftruncate(fd, length) == 0)
187+
return 0;
188+
if (errno != EINVAL)
189+
return -1;
184190
# else
185191
// Conforming POSIX systems have posix_fallocate.
186192
const int res = ::posix_fallocate(fd, 0, length);

0 commit comments

Comments
 (0)