summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/smbd/open.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 4581553be2..cb43dd28ca 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -291,7 +291,26 @@ static NTSTATUS fd_open(struct connection_struct *conn,
fsp->fh->fd = SMB_VFS_OPEN(conn, smb_fname, fsp, flags, mode);
if (fsp->fh->fd == -1) {
- status = map_nt_error_from_unix(errno);
+#ifdef O_NOFOLLOW
+ int posix_errno = errno;
+#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;
+ }
+#endif /* O_NOFOLLOW */
+ status = map_nt_error_from_unix(posix_errno);
if (errno == EMFILE) {
static time_t last_warned = 0L;