Skip to content

Commit

Permalink
use stat, not lstat for filtering, as we want to walk through symlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
kaniini committed Aug 4, 2021
1 parent a6f8cdb commit 60eadab
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion doas.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,15 @@ parseconfdir(const char *dirpath, int checkperms)
for (i = 0; i < dirent_count; i++)
{
struct stat sb;
size_t pathlen;

snprintf(pathbuf, sizeof pathbuf, "%s/%s", dirpath, dirent_table[i]->d_name);
pathlen = snprintf(pathbuf, sizeof pathbuf, "%s/%s", dirpath, dirent_table[i]->d_name);
free(dirent_table[i]);

/* make sure path ends in .conf */
if (strcmp(pathbuf + (pathlen - 5), ".conf"))
continue;

if (stat(pathbuf, &sb) != 0)
err(1, "stat(\"%s\")", pathbuf);

Expand Down

0 comments on commit 60eadab

Please sign in to comment.