commit 38cc01b8874900eab684d70847b8ca3a3e580a0f
Author:     Michael Forney <[email protected]>
AuthorDate: Fri Oct 20 22:26:30 2017 -0700
Commit:     Michael Forney <[email protected]>
CommitDate: Sat Oct 21 12:44:09 2017 -0700

    which: Minor simplification

diff --git a/which.c b/which.c
index 1e64452..cc93361 100644
--- a/which.c
+++ b/which.c
@@ -50,12 +50,10 @@ which(const char *path, const char *name)
                                if (i && ptr[i - 1] != '/')
                                        fputc('/', stdout);
                                puts(name);
-                               if (!aflag) {
-                                       close(dirfd);
-                                       break;
-                               }
                        }
                        close(dirfd);
+                       if (!aflag && found)
+                               break;
                }
                p = ptr + i + 1;
        }

Reply via email to