Module Name: src Committed By: kre Date: Fri Feb 3 23:16:38 UTC 2017
Modified Files: src/bin/sh: redir.c Log Message: Fiddle the (new) fdflags implementation: Remove some unnecessary cuteness that limited error reporting. Permit just one -s arg to fdflags Be deterministic in the case of fdflags -s +cloexec,-cloexec 0 (and similar) - use the last specified, always. Allow: FD_0_FLAGS=$( fdflags -v 0 ) # do stuff, manipulating the flags fdflags -s "FD_0_FLAGS" 0 to save/restore flags for a fd. Correctly mask result of fcntl(fd, F_GETFD) with FD_CLOEXEC as the specs require before deciding close on exec is set. Improve portability as a tool, don't assume strtoi(), nor __arraycount() and avoid needlessly requiring recent C versions (ie: there's no need to sprinkle declarations in the middle of the code, it just makes them hard to find, and benefits nothing.) Still to do: As currently implemented, both user, and shell internal fds are reported, and can be manipulated. Allowing users to touch the shell's internal fds is bogus, and providing this easy way to allow users to discover which values they have is poor. Fixing this means getting rid of the use of fcntl(F_MAXFD) and replacing it with a shell maintained memory of what fds the user (script) has allocated. The shell's fd manipulation really still needs major work (including properly fixing bin/48875) To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/bin/sh/redir.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.