[wmiir] Use stat rater than lstat for proglist. Fixes issue #215.

This commit is contained in:
Kris Maglione 2010-08-16 19:38:17 -04:00
parent 96389a015e
commit 675f117026
1 changed files with 3 additions and 3 deletions

View File

@ -434,7 +434,7 @@ static int
xproglist(int argc, char *argv[]) {
DIR *d;
struct dirent *de;
struct stat stat;
struct stat st;
char *dir, *cwd;
int i;
@ -454,8 +454,8 @@ xproglist(int argc, char *argv[]) {
/* Don't use Blprint. wimenu expects UTF-8. */
if(!chdir(cwd) && !chdir(dir) && (d = opendir(dir))) {
while((de = readdir(d))) {
lstat(de->d_name, &stat);
if(S_ISREG(stat.st_mode) && !access(de->d_name, X_OK))
stat(de->d_name, &st);
if(S_ISREG(st.st_mode) && !access(de->d_name, X_OK))
Bprint(outbuf, "%q\n", de->d_name);
}
closedir(d);