diff options
author | Wayne Davison <wayned@users.sourceforge.net> | 2004-04-06 17:45:47 +0000 |
---|---|---|
committer | Wayne Davison <wayned@users.sourceforge.net> | 2004-04-06 17:45:47 +0000 |
commit | 5bae8f00b815da79aaa69a6652a7796ba4a9d68d (patch) | |
tree | 0c2338d4cf451954e8f17712dcaa76c24a63fb7e | |
parent | 98e28ff3ed5268c3bff8a81b18dc02331ff741c5 (diff) | |
download | zsh-5bae8f00b815da79aaa69a6652a7796ba4a9d68d.tar.gz zsh-5bae8f00b815da79aaa69a6652a7796ba4a9d68d.tar.xz zsh-5bae8f00b815da79aaa69a6652a7796ba4a9d68d.zip |
Minor optimization to qualnonemptydir() when a dir has a subdir.
-rw-r--r-- | Src/glob.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Src/glob.c b/Src/glob.c index c0d23aa00..a979674e3 100644 --- a/Src/glob.c +++ b/Src/glob.c @@ -2807,10 +2807,16 @@ qualsheval(char *name, struct stat *buf, off_t days, char *str) static int qualnonemptydir(char *name, struct stat *buf, off_t days, char *str) { - DIR *dirh = opendir(name); + DIR *dirh; struct dirent *de; - if (dirh == NULL) + if (!S_ISDIR(buf->st_mode)) + return 0; + + if (buf->st_nlink > 2) + return 1; + + if (!(dirh = opendir(name))) return 0; while ((de = readdir(dirh))) { |