Skip to content

Commit

Permalink
Test if dir_exists is writeable
Browse files Browse the repository at this point in the history
  • Loading branch information
illusion0001 committed Jun 22, 2023
1 parent 971244f commit 1b59123
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions source/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,12 @@ int file_exists(const char *path)

int dir_exists(const char *path)
{
return file_exists(path);
/*
struct stat sb;
if ((stat(path, &sb) == 0) && sb.st_mode & S_IFDIR) {
return SUCCESS;
}
return FAILED;
*/
if (access(path, W_OK) == 0)
{
return SUCCESS;
}

return FAILED;
}

int unlink_secure(const char *path)
Expand Down

0 comments on commit 1b59123

Please sign in to comment.