The is_directory() function was called once, in a place where we
already had access to its argument's stat structure. Instead, we now
just use S_ISDIR, and the is_directory() function has met its end.
}
-/**
- * @brief Determine whether or not the given file descriptor is for
- * a directory.
- *
- * @param fd
- * The file descriptor whose directoryness is in question.
- *
- * @return true if @c fd describes a directory, and false otherwise.
- */
-bool is_directory(int fd) {
- if (fd <= 0) {
- return false;
- }
-
- struct stat s;
- if (fstat(fd, &s) == 0) {
- return S_ISDIR(s.st_mode);
- }
- else {
- return false;
- }
-}
-
/**
if (!no_exec_mask) {
/* Never mask the execute bit on directories. */
- int ace_result = any_can_execute(fd) || is_directory(fd);
+ int ace_result = any_can_execute(fd) || S_ISDIR(s.st_mode);
if (ace_result == ACL_ERROR) {
perror("apply_default_acl (any_can_execute)");