diff --git a/lib/pure/memfiles.nim b/lib/pure/memfiles.nim index 2ba26e5c84..8e2f61868e 100644 --- a/lib/pure/memfiles.nim +++ b/lib/pure/memfiles.nim @@ -57,8 +57,12 @@ proc setFileSize(fh: FileHandle, newFileSize = -1, oldSize = -1): OSErrorCode = when declared(posix_fallocate): while (e = posix_fallocate(fh, 0, newFileSize); e == EINTR): discard - if (e == EINVAL or e == EOPNOTSUPP) and ftruncate(fh, newFileSize) == -1: - result = osLastError() # fallback arguable; Most portable BUT allows SEGV + if e == EINVAL or e == EOPNOTSUPP or e == ENOSYS: + # fallback arguable; Most portable BUT allows SEGV + if ftruncate(fh, newFileSize) == -1: + result = osLastError() + else: + discard elif e != 0: result = osLastError() else: # shrink the file