libsmb: Avoid a call to SMBC_errno()
authorVolker Lendecke <vl@samba.org>
Fri, 21 Jan 2022 19:29:34 +0000 (20:29 +0100)
committerJeremy Allison <jra@samba.org>
Mon, 7 Feb 2022 19:00:34 +0000 (19:00 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/libsmb/libsmb_dir.c

index a9197f20156c2916070848d39b70da8eb570bead..2f4a3815bb272adf99528f42bebe238358610304 100644 (file)
@@ -2242,9 +2242,14 @@ SMBC_unlink_ctx(SMBCCTX *context,
        }
        /*d_printf(">>>unlink: resolved path as %s\n", targetpath);*/
 
-       if (!NT_STATUS_IS_OK(cli_unlink(targetcli, targetpath, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN))) {
+       status = cli_unlink(
+               targetcli,
+               targetpath,
+               FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
 
-               errno = SMBC_errno(context, targetcli);
+       if (!NT_STATUS_IS_OK(status)) {
+
+               errno = cli_status_to_errno(status);
 
                if (errno == EACCES) { /* Check if the file is a directory */