syscall: fix duplicate fd bug for Plan 9
syscall: fix duplicate fd bug for Plan 9

This change comes from CL 5536043,
created by Andrey Mirtchovski. His
description follows:

"The plan9 exec child handler does not manage
dup-ed fds from the parent correctly: when a
dup-ed file descriptor appears in the child's fd
list it is closed when first encountered and then
subsequent attempt to dup it later in Pass 2 fails,
resulting in 'fork/exec: fd out of range or not
open'."

R=golang-dev, rminnich, ality
CC=golang-dev, mirtchovski, rsc
http://codereview.appspot.com/6009046

Committer: Anthony Martin <35eacf30aabdab61efbd37765ec632fc68b70c11@pbrane.org>

mhennings/marcohennings-go,bryanxu/go-zh,d0f/go-zh,scirelli/scirelli-go,sanjosh/sanjos100-tipc,webfd/go-zh,webfd/go-zh,webfd/go-zh,bryanxu/go-zh,mhennings/marcohennings-go,glycerine/jeaten-go-arrayof-structof,mhennings/marcohennings-go,mhennings/marcohennings-go,scirelli/scirelli-go,bryanxu/go-zh,rflanagan/reginaldflanagan-project1,d0f/go-zh,Triskite/willstone-goclone,mhennings/marcohennings-go,rdp/rogerpack2005-golang,webfd/go-zh,scirelli/scirelli-go,glycerine/jeaten-go-arrayof-structof,webfd/go-zh,mhennings/marcohennings-go,scirelli/scirelli-go,glycerine/jeaten-go-arrayof-structof,glycerine/jeaten-go-arrayof-structof,glycerine/jeaten-go-arrayof-structof,d0f/go-zh,mhennings/marcohennings-go,sanjosh/sanjos100-tipc,glycerine/jeaten-go-arrayof-structof,sanjosh/sanjos100-tipc,rdp/rogerpack2005-golang,Triskite/willstone-goclone,rdp/rogerpack2005-golang,rflanagan/reginaldflanagan-project1,Triskite/willstone-goclone,bryanxu/go-zh,rflanagan/reginaldflanagan-project1,scirelli/scirelli-go,Triskite/willstone-goclone,d0f/go-zh,webfd/go-zh,d0f/go-zh,scirelli/scirelli-go,sanjosh/sanjos100-tipc,Triskite/willstone-goclone,glycerine/jeaten-go-arrayof-structof,mhennings/marcohennings-go,rdp/rogerpack2005-golang,d0f/go-zh,sanjosh/sanjos100-tipc,rdp/rogerpack2005-golang,rflanagan/reginaldflanagan-project1,rflanagan/reginaldflanagan-project1,rflanagan/reginaldflanagan-project1,Triskite/willstone-goclone,bryanxu/go-zh,rflanagan/reginaldflanagan-project1,rdp/rogerpack2005-golang,rflanagan/reginaldflanagan-project1,scirelli/scirelli-go,scirelli/scirelli-go,webfd/go-zh,sanjosh/sanjos100-tipc,bryanxu/go-zh,sanjosh/sanjos100-tipc,glycerine/jeaten-go-arrayof-structof,bryanxu/go-zh,rdp/rogerpack2005-golang,sanjosh/sanjos100-tipc,bryanxu/go-zh,d0f/go-zh,d0f/go-zh,webfd/go-zh,Triskite/willstone-goclone,rdp/rogerpack2005-golang,Triskite/willstone-goclone