From: Jeff Mahoney Date: Mon, 11 May 2009 18:25:34 +0000 (-0400) Subject: dup2: Fix return value with oldfd == newfd and invalid fd X-Git-Tag: linux-omap-v2.6.30-rc6~39 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2b79bc4f7ebbd5af3c8b867968f9f15602d5f802;p=pandora-kernel.git dup2: Fix return value with oldfd == newfd and invalid fd The return value of dup2 when oldfd == newfd and the fd isn't valid is not getting properly sign extended. We end up with 4294967287 instead of -EBADF. I've reproduced this on SLE11 (2.6.27.21), openSUSE Factory (2.6.29-rc5), and Ubuntu 9.04 (2.6.28). This patch uses a signed int for the error value so it is properly extended. Commit 6c5d0512a091480c9f981162227fdb1c9d70e555 introduced this regression. Reported-by: Jiri Dluhos Signed-off-by: Jeff Mahoney Signed-off-by: Linus Torvalds --- Reading git-diff-tree failed