Fix for #2359

We try to avoid implicit conversion from pointers to bool.
Can you make this
```
while ((ep = readdir(dp)) != NULL && cnt <= 2) {
```