#ifdef O_NOFOLLOW
fd = open(pathname, flags|O_NOFOLLOW);
#else
+ if (do_lstat(pathname, &l_st) < 0)
+ return -1;
+ if (S_ISLNK(l_st.st_mode)) {
+ errno = ELOOP;
+ return -1;
+ }
if ((fd = open(pathname, flags)) < 0)
return fd;
-
if (do_fstat(fd, &f_st) < 0) {
close_and_return_error:
{
}
return -1;
}
- if (do_lstat(pathname, &l_st) < 0)
- goto close_and_return_error;
- if (S_ISLNK(l_st.st_mode)) {
- errno = ELOOP;
- goto close_and_return_error;
- }
if (l_st.st_dev != f_st.st_dev || l_st.st_ino != f_st.st_ino) {
errno = EINVAL;
goto close_and_return_error;