sort: simplify -o handling to avoid fdopen, assert
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 2 Jul 2012 22:47:03 +0000 (15:47 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 2 Jul 2012 23:46:59 +0000 (16:46 -0700)
commit59daf05b75f1898ff435ff13983da8d20d4436aa
treeefb34a7f55db18375a899df5ca7843920680bf54
parent44fbd3fd862e34d42006f8b74cb11c9c56346417
sort: simplify -o handling to avoid fdopen, assert

* src/sort.c (outfd): Remove.  All uses replaced by STDOUT_FILENO.
(stream_open): When writing, use stdout rather than fdopen.
(move_fd_or_die): Renamed from dup2_or_die, with the added functionality
of closing its first argument.  All uses changed.
(avoid_trashing_input): Special case for !outfile no longer needed.
(check_output): Arrange for standard output to go to the file,
rather than storing the fd in outfd.
src/sort.c