fs: handle non-functional statx system call
statx is not implemented on RHEL 7 and trying to call it from within a docker container might result in a return value of 1 (which is not an expected value according to statx man page, expected values are 0 or -1) and errno is set to 0, in which case assume statx is not implemented. Above behaviour has been seen on RHEL 7 running on a s390. PR-URL: https://github.com/libuv/libuv/pull/2529 Refs: https://bugzilla.redhat.com/show_bug.cgi?id=1759152 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This commit is contained in:
parent
f961844392
commit
96cfa783a2
@ -1234,13 +1234,22 @@ static int uv__fs_statx(int fd,
|
||||
|
||||
rc = uv__statx(dirfd, path, flags, mode, &statxbuf);
|
||||
|
||||
if (rc == -1) {
|
||||
switch (rc) {
|
||||
case 0:
|
||||
break;
|
||||
case -1:
|
||||
/* EPERM happens when a seccomp filter rejects the system call.
|
||||
* Has been observed with libseccomp < 2.3.3 and docker < 18.04.
|
||||
*/
|
||||
if (errno != EINVAL && errno != EPERM && errno != ENOSYS)
|
||||
return -1;
|
||||
|
||||
/* Fall through. */
|
||||
default:
|
||||
/* Normally on success, zero is returned and On error, -1 is returned.
|
||||
* Observed on S390 RHEL running in a docker container with statx not
|
||||
* implemented, rc might return 1 with 0 set as the error code in which
|
||||
* case we return ENOSYS.
|
||||
*/
|
||||
no_statx = 1;
|
||||
return UV_ENOSYS;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user