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)
committerRalph Boehme <slow@samba.org>
Tue, 17 Oct 2017 05:46:20 +0000 (07:46 +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>
source3/smbd/dosmode.c

index 3181f2e78a92611c2e963686779fe414d8e31869..73112dc9ab0a034dbb4458ddfcae8683f5f80c0f 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,
-                            SAMBA_XATTR_DOS_ATTRIB, blob.data, blob.length,
-                            0) == -1) {
+       ret = SMB_VFS_SETXATTR(conn, smb_fname,
+                              SAMBA_XATTR_DOS_ATTRIB,
+                              blob.data, blob.length, 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();