On Thu, 3 Jun 2021 10:02:20 +1200 Mark Davies <m...@ecs.vuw.ac.nz> wrote:
> > > On 2/06/21 5:49 am, Robert Elz wrote: > > And while doing that, ask them what they're possibly trying to achieve > > with the O_CREAT flag - if /proc/$$/fd/N doesn't exist, how is creating > > (what would be a normal file, if procfs allowed it) going to possibly > > do anything useful? It is hard to believe that they're intending that > > creating a file there will magically cause the fd to open (open to > > what underlying object?) If they know the fd is open (which they > > seem to do here) then they know that /proc/$$/fd/N already exists, in > > which case O_CREAT is useless (in the best of cases). > > I think that is because after they set the path to /proc/self/fd/N they > pass it back to their generic open routines to do the actual open. > see reopen_from_procfd() in source3/smbd/open.c > > cheers > mark And why rely on procfs to open file descriptors? Shell scripts do it, but a C program should know better.