Skip to content

Commit

Permalink
s4/pvfs: handle non-POSIX compliant Tru64, NetBSD and FreeBSD errno o…
Browse files Browse the repository at this point in the history
…n O_NOFOLLOW symlink open calls

see also f75f1d6
  • Loading branch information
Björn Jacke committed Jun 10, 2012
1 parent f97ca7d commit 2fb4c55
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion source4/ntvfs/posix/pvfs_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,11 +405,32 @@ int pvfs_sys_unlink(struct pvfs_state *pvfs, const char *filename, bool allow_ov
static bool contains_symlink(const char *path)
{
int fd = open(path, PVFS_NOFOLLOW | O_RDONLY);
int posix_errno = errno;
if (fd != -1) {
close(fd);
return false;
}
return (errno == ELOOP);

#if defined(ENOTSUP) && defined(OSF1)
/* handle special Tru64 errno */
if (errno == ENOTSUP) {
posix_errno = ELOOP;
}
#endif /* ENOTSUP */

#ifdef EFTYPE
/* fix broken NetBSD errno */
if (errno == EFTYPE) {
posix_errno = ELOOP;
}
#endif /* EFTYPE */

/* fix broken FreeBSD errno */
if (errno == EMLINK) {
posix_errno = ELOOP;
}

return (posix_errno == ELOOP);
}

/*
Expand Down

0 comments on commit 2fb4c55

Please sign in to comment.