fchmod(2) inherited file descriptors before exec(3)'ing a command
  • C 62.3%
  • Shell 26.5%
  • Makefile 11.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-07-23 07:27:05 -04:00
test test: add tests 2026-07-23 07:27:05 -04:00
.gitignore fchmodexec: fchmod(2) inherited fd's 2021-03-19 06:50:29 -04:00
fchmodexec.c 0.3.2: standardize exit status 2022-11-13 08:47:31 -05:00
libdisablefchmod.c doc: update copyright date 2026-07-20 09:21:06 -04:00
LICENSE doc: update copyright dates 2026-07-18 09:08:43 -04:00
Makefile test: libdisablefchmod 2024-06-11 07:58:41 -04:00
musl-make build: musl: do not build lib with -static 2024-12-02 07:37:51 -05:00
README.md doc: libdisablefchmod: fix stdio 2026-07-19 09:00:27 -04:00

SYNOPSIS

fchmodexec mode fd ... -- cmd ...

LD_PRELOAD=libdisablefchmod.so command ...

DESCRIPTION

fchmodexec - fchmod(2) inherited file descriptors before exec(3)'ing a command

fchmodexec modifies the permissions of files referred to by open file descriptors inherited from the parent process before executing a program.

libdisablefchmod: Disables calls to fchmod(2) on stdout and stderr by dynamically linked executables.

EXAMPLES

fchmodexec

$ umask 077; (fchmodexec 644 1 -- ls -al out) > out
$ cat out
-rw-r--r-- 1 msantos msantos 0 Mar 18 07:32 out
$ ls -al out
-rw-r--r-- 1 msantos msantos 48 Mar 18 07:32 out

libdisablefchmod

$ umask 022; (LD_PRELOAD=libdisablefchmod.so fchmodexec 111 1 -- ls -al out) > out
$ cat out
-rw-r--r-- 1 msantos msantos 0 Mar 18 07:32 out
$ ls -al out
-rw-r--r-- 1 msantos msantos 48 Mar 18 07:32 out

OPTIONS

None.

BUILDING

make

# also build libdisablefchmod
make all

# statically linked executable
./musl-make

SEE ALSO

exec(3), fchmod(2)