From 52d6f78a9a24882c276ceaba451639e2e1a2e727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 26 Nov 2009 16:58:36 +0000 Subject: [PATCH] * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34292 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/libroot/posix/unistd/directory.c | 29 ++++++--------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/src/system/libroot/posix/unistd/directory.c b/src/system/libroot/posix/unistd/directory.c index 790738cc4e..8238514407 100644 --- a/src/system/libroot/posix/unistd/directory.c +++ b/src/system/libroot/posix/unistd/directory.c @@ -1,39 +1,28 @@ /* - * Copyright 2002-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Copyright 2002-2009, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. */ -#include - -#include -#include #include +#include +#include - -#define RETURN_AND_SET_ERRNO(err) \ - if (err < 0) { \ - errno = err; \ - return -1; \ - } \ - return err; +#include +#include int chdir(const char *path) { - int status = _kern_setcwd(-1, path); - - RETURN_AND_SET_ERRNO(status); + RETURN_AND_SET_ERRNO(_kern_setcwd(-1, path)); } int fchdir(int fd) { - int status = _kern_setcwd(fd, NULL); - - RETURN_AND_SET_ERRNO(status); + RETURN_AND_SET_ERRNO(_kern_setcwd(fd, NULL)); } @@ -68,8 +57,6 @@ getcwd(char *buffer, size_t size) int rmdir(const char *path) { - int status = _kern_remove_dir(-1, path); - - RETURN_AND_SET_ERRNO(status); + RETURN_AND_SET_ERRNO(_kern_remove_dir(-1, path)); }