which: Minor simplification

This commit is contained in:
Michael Forney 2017-10-20 22:26:30 -07:00
parent 3b604b179c
commit 38cc01b887

View File

@ -50,12 +50,10 @@ which(const char *path, const char *name)
if (i && ptr[i - 1] != '/') if (i && ptr[i - 1] != '/')
fputc('/', stdout); fputc('/', stdout);
puts(name); puts(name);
if (!aflag) {
close(dirfd);
break;
}
} }
close(dirfd); close(dirfd);
if (!aflag && found)
break;
} }
p = ptr + i + 1; p = ptr + i + 1;
} }