]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3/smbd: README.Coding fixes in set_ea_dos_attribute
authorRalph Boehme <slow@samba.org>
Thu, 12 Oct 2017 13:41:01 +0000 (15:41 +0200)
committerKarolin Seeger <kseeger@samba.org>
Wed, 25 Oct 2017 06:43:01 +0000 (08:43 +0200)
While I'm at it, some README.Coding fixes in set_ea_dos_attribute.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12995

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit fbad64200e0199acb644d83073234b2f6c200fce)

source3/smbd/dosmode.c

index df755427187d85e694c6a01e6bf57e44b16c202a..fdbc7517985adb70ad6268846f391f45632f1adb 100644 (file)
@@ -415,6 +415,7 @@ NTSTATUS set_ea_dos_attribute(connection_struct *conn,
        struct xattr_DOSATTRIB dosattrib;
        enum ndr_err_code ndr_err;
        DATA_BLOB blob;
+       int ret;
 
        if (!lp_store_dos_attributes(SNUM(conn))) {
                return NT_STATUS_NOT_IMPLEMENTED;
@@ -456,14 +457,15 @@ NTSTATUS set_ea_dos_attribute(connection_struct *conn,
                return NT_STATUS_INVALID_PARAMETER;
        }
 
-       if (SMB_VFS_SETXATTR(conn, smb_fname->base_name,
+       ret = SMB_VFS_SETXATTR(conn, smb_fname->base_name,
                             SAMBA_XATTR_DOS_ATTRIB, blob.data, blob.length,
-                            0) == -1) {
+                            0);
+       if (ret != 0) {
                NTSTATUS status = NT_STATUS_OK;
                bool need_close = false;
                files_struct *fsp = NULL;
 
-               if((errno != EPERM) && (errno != EACCES)) {
+               if ((errno != EPERM) && (errno != EACCES)) {
                        DBG_INFO("Cannot set "
                                 "attribute EA on file %s: Error = %s\n",
                                 smb_fname_str_dbg(smb_fname), strerror(errno));
@@ -475,7 +477,7 @@ NTSTATUS set_ea_dos_attribute(connection_struct *conn,
                */
 
                /* Check if we have write access. */
-               if(!CAN_WRITE(conn) || !lp_dos_filemode(SNUM(conn)))
+               if (!CAN_WRITE(conn) || !lp_dos_filemode(SNUM(conn)))
                        return NT_STATUS_ACCESS_DENIED;
 
                if (!can_write_to_file(conn, smb_fname)) {
@@ -496,9 +498,10 @@ NTSTATUS set_ea_dos_attribute(connection_struct *conn,
                }
 
                become_root();
-               if (SMB_VFS_FSETXATTR(fsp,
-                                    SAMBA_XATTR_DOS_ATTRIB, blob.data,
-                                    blob.length, 0) == 0) {
+               ret = SMB_VFS_FSETXATTR(fsp,
+                                       SAMBA_XATTR_DOS_ATTRIB,
+                                       blob.data, blob.length, 0);
+               if (ret == 0) {
                        status = NT_STATUS_OK;
                }
                unbecome_root();