Michael Stone <[EMAIL PROTECTED]> wrote: > This same problem (can't use /dev/stdin) probably affects a few other > commands also. The problem seems to be that fd_reopen is used to set > the stdin fd to some other file, but closes stdin first. (At which > point /dev/stdin will disappear.) The basic request seems reasonable, > and the current behavior is arguably a bug caused by an implementation > detail. How to fix, though? One possibility is to special case each > invocation, and test, e.g., file = "/dev/stdin" as well as file = > NULL. This seems kind of hackish (would fail, e.g., for /proc/$$/fd/0 > and who knows what else).
Hackish, indeed. In spite of that, I'd be tempted to go this route, but for the fact that on a system without /dev/stdin, dd would then start accepting if=/dev/stdin, whereas now it rejects it with ENOENT. > Another possibility is to not close in > fd_reopen until after the open, which would force a dup in every > case. Downside to that is the possibility that the operation will fail > if an extra fd is unavaiable. Maybe try open, and if that fails due > to insufficient fds, close and then try open again? FYI, these are the other programs that use fd_reopen: src/csplit.c src/dd.c src/nohup.c src/split.c src/stty.c src/touch.c Using fd_reopen is an improvement on one hand, but if I'd known initially that using it would invalidate certain uses of names like /dev/stdin and /dev/stdout, I probably would not have made the change. Fixing this is not urgent, of course. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]