X-Git-Url: https://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2Fapply-default-acl.c;h=d2f8f536b530fa5b63d8fe605c75ab1ac1f737af;hb=1be99786d05f3a7a75a17badae7b42491442a17a;hp=29ca5faa9ddde14aa8e0344b1870c2d713705770;hpb=6ac6902a55f6fd0427373db4d6dd5eedb6e330df;p=apply-default-acl.git diff --git a/src/apply-default-acl.c b/src/apply-default-acl.c index 29ca5fa..d2f8f53 100644 --- a/src/apply-default-acl.c +++ b/src/apply-default-acl.c @@ -92,29 +92,6 @@ bool is_path_directory(const char* path) { } -/** - * @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; - } -} - /** @@ -641,7 +618,7 @@ int apply_default_acl(const char* path, bool no_exec_mask) { 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)");