diff --git a/src/system/libroot/posix/unistd/dup.c b/src/system/libroot/posix/unistd/dup.c index 03ec769213..a585a9ad4d 100644 --- a/src/system/libroot/posix/unistd/dup.c +++ b/src/system/libroot/posix/unistd/dup.c @@ -1,35 +1,25 @@ -/* - * Copyright 2004-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +/* + * Copyright 2004-2009, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. */ -#include -#include #include +#include + +#include +#include int dup(int fd) { - int status = _kern_dup(fd); - if (status < 0) { - errno = status; - status = -1; - } - - return status; + RETURN_AND_SET_ERRNO(_kern_dup(fd)); } int dup2(int oldFD, int newFD) { - int status = _kern_dup2(oldFD, newFD); - if (status < 0) { - errno = status; - status = -1; - } - - return status; + RETURN_AND_SET_ERRNO(_kern_dup2(oldFD, newFD)); }