> If you are getting an error nothing has happened, no replacement of newfd and > no close
I wish that sentence was written on the man page. That was the way I first understood it too (and it makes more sense) but the little information I found disagree (libuv [1], python [2] (see the note about dup2)). The man page says that "The steps of closing and reusing the file descriptor newfd are performed atomically", but it is possible that such sentence is only meant to imply that newfd is never reusable during the syscall. I'm not comfortable accepting your interpretation of "atomic" when there is no clear reference and the python implementation disagree; that's why I'm asking for more evidence. [1] https://github.com/libuv/libuv/issues/462 [2] https://www.python.org/dev/peps/pep-0475/ -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAEvMKD8b%2BtC3hJ0k51mpvMBsYq9FTTazotNiFF2ZpKUQTGqAkw%40mail.gmail.com.