summaryrefslogtreecommitdiff
path: root/source4/ntvfs/posix/pvfs_sys.c
diff options
context:
space:
mode:
authorBjörn Jacke <bj@sernet.de>2012-06-10 20:17:44 +0200
committerBjoern Jacke <bj@sernet.de>2012-06-10 21:38:08 +0200
commit2fb4c551e8a87cbdfff014a8c9c4ebd6f138d01e (patch)
tree258fcdaa30b5fbf0d85e9dc2e69988a89e37b25b /source4/ntvfs/posix/pvfs_sys.c
parentf97ca7d64318343eb1fd2ed3d8248c6560166fb4 (diff)
downloadsamba-2fb4c551e8a87cbdfff014a8c9c4ebd6f138d01e.tar.gz
samba-2fb4c551e8a87cbdfff014a8c9c4ebd6f138d01e.tar.bz2
samba-2fb4c551e8a87cbdfff014a8c9c4ebd6f138d01e.zip
s4/pvfs: handle non-POSIX compliant Tru64, NetBSD and FreeBSD errno on O_NOFOLLOW symlink open calls
see also f75f1d62339f0accb4e574645b1d265c75a01b5b
Diffstat (limited to 'source4/ntvfs/posix/pvfs_sys.c')
-rw-r--r--source4/ntvfs/posix/pvfs_sys.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/source4/ntvfs/posix/pvfs_sys.c b/source4/ntvfs/posix/pvfs_sys.c
index 9112848bfe..5775d0bb77 100644
--- a/source4/ntvfs/posix/pvfs_sys.c
+++ b/source4/ntvfs/posix/pvfs_sys.c
@@ -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);
}
/*