From e670b3564c3c12baaab0e988f155a86b9437f66e Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 26 Mar 2001 19:18:06 +0000 Subject: smbd/posix_acls.c: Saving and restoring errno here is the wrong place. Moved it to the places where [f]chmod_acl is called instead. Jeremy. (This used to be commit 641ada44ae6429761c1fd0dbcafabc69f897fac7) --- source3/smbd/vfs-wrap.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'source3/smbd/vfs-wrap.c') diff --git a/source3/smbd/vfs-wrap.c b/source3/smbd/vfs-wrap.c index 8750f71151..a4057eb7ce 100644 --- a/source3/smbd/vfs-wrap.c +++ b/source3/smbd/vfs-wrap.c @@ -115,8 +115,10 @@ int vfswrap_mkdir(connection_struct *conn, char *path, mode_t mode) * group permission bits. This is not what we want, as it will * mess up any inherited ACL bits that were set. JRA. */ + int saved_errno = errno; /* We may get ENOSYS */ if (conn->vfs_ops.chmod_acl != NULL) { - conn->vfs_ops.chmod_acl(conn, path, mode); + if ((conn->vfs_ops.chmod_acl(conn, path, mode) == -1) && (errno == ENOSYS)) + errno = saved_errno; } } @@ -351,11 +353,15 @@ int vfswrap_chmod(connection_struct *conn, char *path, mode_t mode) * group owner bits directly. JRA. */ + if (conn->vfs_ops.chmod_acl != NULL) { + int saved_errno = errno; /* We might get ENOSYS */ if ((result = conn->vfs_ops.chmod_acl(conn, path, mode)) == 0) { END_PROFILE(syscall_chmod); return result; } + /* Error - return the old errno. */ + errno = saved_errno; } result = chmod(path, mode); -- cgit