Work around copy_file_range() bug in eCryptFs

When programs like ar.ape and compile.ape are run on eCryptFs partitions
on Linux, copy_file_range() will fail with EINVAL which is wrong because
eCryptFs which doesn't support this system call, should raise EOPNOTSUPP

See https://github.com/jart/cosmopolitan/discussions/1305
This commit is contained in:
Justine Tunney 2024-09-29 16:31:48 -07:00
parent 12cc2de22e
commit fef24d622a
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
5 changed files with 9 additions and 3 deletions

View file

@ -298,6 +298,7 @@ static void CopyFileOrDie(const char *inpath, int infd, //
if (got != -1) {
exchanged = got;
} else if (errno == EXDEV || // different partitions
errno == EINVAL || // possible w/ ecryptfs
errno == ENOSYS || // not linux or freebsd
errno == ENOTSUP || // probably a /zip file
errno == EOPNOTSUPP) { // technically the same