]> Cypherpunks repositories - gostls13.git/commit
syscall: check Fchmodat flags parameter on Linux
authorTobias Klauser <tklauser@distanz.ch>
Wed, 13 Jun 2018 13:54:42 +0000 (15:54 +0200)
committerTobias Klauser <tobias.klauser@gmail.com>
Wed, 13 Jun 2018 20:32:08 +0000 (20:32 +0000)
commitfb4fb0430b8d77b5487f51fd780bba25476e816c
tree8c8c1812e404a0d903278af37e750a4826f5d9a5
parent4a778cdf3375d418062b3c3e9f6891cc9162e3d0
syscall: check Fchmodat flags parameter on Linux

As mentioned in #25845, port CL 46474 from golang.org/x/sys/unix to the
syscall package.

Currently Linux' fchmodat(2) syscall implementation doesn't support the
flags parameter (though it might in future versions [1]). Fchmodat in
the syscall package takes the parameter and (wrongly) passes it on to the
syscall which will ignore it.

According to the POSIX.1-2008 manual page [2], AT_SYMLINK_NOFOLLOW is
the only valid value for the flags parameter and EOPNOTSUPP should be
returned in case changing the mode of a symbolic link is not supported
by the underlying system. EINVAL should be returned for any other value
of the flags parameter.

  [1] https://patchwork.kernel.org/patch/9596301/
  [2] http://pubs.opengroup.org/onlinepubs/9699919799/functions/chmod.html

Updates #20130
Updates #25845

Change-Id: I1021dd0e6a4f4cb3557cb1c1b34dd618c378cda6
Reviewed-on: https://go-review.googlesource.com/118658
Reviewed-by: Ian Lance Taylor <iant@golang.org>
13 files changed:
src/syscall/syscall_linux.go
src/syscall/syscall_linux_test.go
src/syscall/zsyscall_linux_386.go
src/syscall/zsyscall_linux_amd64.go
src/syscall/zsyscall_linux_arm.go
src/syscall/zsyscall_linux_arm64.go
src/syscall/zsyscall_linux_mips.go
src/syscall/zsyscall_linux_mips64.go
src/syscall/zsyscall_linux_mips64le.go
src/syscall/zsyscall_linux_mipsle.go
src/syscall/zsyscall_linux_ppc64.go
src/syscall/zsyscall_linux_ppc64le.go
src/syscall/zsyscall_linux_s390x.go