Don't depend on an implementation detail of S_ISREG and S_ISDIR
Use proper argument list