This often indicates a non-fatal error, so callers might want to
know.
if (!dirname)
goto err;
/* check if directory exists */
- ret = stat(dirname, &statbuf);
+ ret = osl_stat(dirname, &statbuf);
free(dirname);
- if (ret < 0) {
- ret = -E_OSL_STAT;
+ if (ret < 0)
goto err;
- }
ret = -E_OSL_NOTDIR;
if (!S_ISDIR(statbuf.st_mode))
goto err;
if (ret >= 0)
return ret;
- return -E_OSL_OPEN;
+ return errno == ENOENT? -E_OSL_NOENT : -E_OSL_OPEN;
}
/**
return ret;
fd = ret;
if (fstat(fd, &file_status) < 0) {
- ret = -E_OSL_FSTAT;
+ ret = errno == ENOENT? -E_OSL_NOENT : -E_OSL_STAT;
goto out;
}
*size = file_status.st_size;
{
if (stat(path, buf) >= 0)
return 1;
- return -E_OSL_STAT;
+ return errno == ENOENT? -E_OSL_NOENT : -E_OSL_STAT;
}