From: Andre Noll Date: Sun, 13 Aug 2017 01:59:35 +0000 (+0200) Subject: fd.c: Remove para_fchdir(). X-Git-Tag: v0.6.1~16 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=12dc519663c785a3c0be60202d0825ddb8e8d02e;ds=sidebyside fd.c: Remove para_fchdir(). It was a trivial wrapper which was used only in for_each_file_in_dir(). Just open-code it there. --- diff --git a/fd.c b/fd.c index dc4fd59c..49736448 100644 --- a/fd.c +++ b/fd.c @@ -573,20 +573,6 @@ close_cwd: return ret; } -/** - * A wrapper for fchdir(). - * - * \param fd An open file descriptor. - * - * \return Standard. - */ -static int para_fchdir(int fd) -{ - if (fchdir(fd) < 0) - return -ERRNO_TO_PARA_ERROR(errno); - return 1; -} - /** * A wrapper for mkdir(2). * @@ -749,7 +735,7 @@ int for_each_file_in_dir(const char *dirname, { DIR *dir; struct dirent *entry; - int cwd_fd, ret2, ret = para_opendir(dirname, &dir, &cwd_fd); + int cwd_fd, ret = para_opendir(dirname, &dir, &cwd_fd); if (ret < 0) return ret == -ERRNO_TO_PARA_ERROR(EACCES)? 1 : ret; @@ -785,9 +771,8 @@ int for_each_file_in_dir(const char *dirname, ret = 1; out: closedir(dir); - ret2 = para_fchdir(cwd_fd); - if (ret2 < 0 && ret >= 0) - ret = ret2; + if (fchdir(cwd_fd) < 0 && ret >= 0) + ret = -ERRNO_TO_PARA_ERROR(errno); close(cwd_fd); return ret; }