/* 0, if the attempt succeeded and the file turned out not to be a directory.  */
int test_for_directory(const char *path)
/* 0, if the attempt succeeded and the file turned out not to be a directory.  */
int test_for_directory(const char *path)
{
    ws_statb64 statb;
    if (ws_stat64(path, &statb) < 0)
        return errno;
    if (S_ISDIR(statb.st_mode))
        return EISDIR;
    else
        return 0;
}