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).
*
{
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;
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;
}