1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-10 21:49:28 +03:00

s4/pvfs: handle non-POSIX compliant Tru64, NetBSD and FreeBSD errno on O_NOFOLLOW symlink open calls

see also f75f1d6233
This commit is contained in:
Björn Jacke
2012-06-10 20:17:44 +02:00
committed by Bjoern Jacke
parent f97ca7d643
commit 2fb4c551e8

View File

@ -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);
}
/*