Fails under FreeBSD 13 as well: root@f13:~xci # touch foo.txt root@f13:~xci # cc -o s s.c root@f13:~xci # ./s fd = 3 new_fd = -1 root@f13:~xci # uname -a FreeBSD f13 13.0-RELEASE FreeBSD 13.0-RELEASE #0 releng/13.0-n244733-ea31abc261f: Fri Apr 9 04:24:09 UTC 2021 r...@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64
On Tue, 1 Jun 2021 at 10:54, Chavdar Ivanov <ci4...@gmail.com> wrote: > > On Tue, 1 Jun 2021 at 10:13, Martin Husemann <mar...@duskware.de> wrote: > > > > On Tue, Jun 01, 2021 at 10:03:50AM +0100, Chavdar Ivanov wrote: > > > Succeeds for me: > > > ... > > > ? ~ gcc -o s s.c > > > ? ~ ./s > > > fd = -1 > > > new_fd = -1 > > > > You need to touch foo.txt upfront, that will make the first open work, but > > the second fail: > > > > > ./a.out > > fd = 3 > > new_fd = -1 > > > > > > ... so I can reproduce the issue. I am not sure this shold succeed, but it > > is a gray area (and semantics for procfs are not well defined). > > Same; I've mistyped 'foo.tx' in the touch command. > > > > > Martin > > > > -- > ---- -- ----