X-Git-Url: https://git.danieliu.xyz/?p=dmenu.git;a=blobdiff_plain;f=lsx.c;h=325c50855a6e626ddc99f01f385606f405e00ae6;hp=7b84acc9a7a86e49825ab05be688dd924531446d;hb=eadf090413c530e69e8568492ebeb4b4087bd2ad;hpb=8ec1b41cacb33be39bc53fc67a4fe51d2d3ab3a0 diff --git a/lsx.c b/lsx.c index 7b84acc..325c508 100644 --- a/lsx.c +++ b/lsx.c @@ -6,7 +6,7 @@ #include #include -static void lsx(const char *s); +static void lsx(const char *dir); int main(int argc, char *argv[]) { @@ -34,9 +34,7 @@ lsx(const char *dir) { } while((d = readdir(dp))) { snprintf(buf, sizeof buf, "%s/%s", dir, d->d_name); - if(stat(buf, &st) == -1) - perror(buf); - else if(S_ISREG(st.st_mode) && access(buf, X_OK) == 0) + if(stat(buf, &st) == 0 && S_ISREG(st.st_mode) && access(buf, X_OK) == 0) puts(d->d_name); } closedir(dp);