/* Options check. */
if (options & ~FTS_OPTIONMASK) {
- errno = EINVAL;
+ __set_errno (EINVAL);
return (NULL);
}
for (root = NULL, nitems = 0; *argv; ++argv, ++nitems) {
/* Don't allow zero-length paths. */
if ((len = strlen(*argv)) == 0) {
- errno = ENOENT;
+ __set_errno (ENOENT);
goto mem3;
}
/* Set errno and return. */
if (!ISSET(FTS_NOCHDIR) && saved_errno) {
- errno = saved_errno;
+ __set_errno (saved_errno);
return (-1);
}
return (0);
* can distinguish between error and EOF.
*/
free(p);
- errno = 0;
+ __set_errno (0);
return (sp->fts_cur = NULL);
}
if (FCHDIR(sp, p->fts_symfd)) {
saved_errno = errno;
(void)close(p->fts_symfd);
- errno = saved_errno;
+ __set_errno (saved_errno);
SET(FTS_STOP);
return (NULL);
}
{
if (instr && instr != FTS_AGAIN && instr != FTS_FOLLOW &&
instr != FTS_NOINSTR && instr != FTS_SKIP) {
- errno = EINVAL;
+ __set_errno (EINVAL);
return (1);
}
p->fts_instr = instr;
int fd;
if (instr && instr != FTS_NAMEONLY) {
- errno = EINVAL;
+ __set_errno (EINVAL);
return (NULL);
}
* Errno set to 0 so user can distinguish empty directory from
* an error.
*/
- errno = 0;
+ __set_errno (0);
/* Fatal errors stop here. */
if (ISSET(FTS_STOP))
free(p);
fts_lfree(head);
(void)closedir(dirp);
- errno = saved_errno;
+ __set_errno (saved_errno);
cur->fts_info = FTS_ERR;
SET(FTS_STOP);
return (NULL);
if (stat(p->fts_accpath, sbp)) {
saved_errno = errno;
if (!lstat(p->fts_accpath, sbp)) {
- errno = 0;
+ __set_errno (0);
return (FTS_SLNONE);
}
p->fts_errno = saved_errno;