s3:modules: VFS CAP symlinkat always fails
authorPavel Filipenský <pfilipen@redhat.com>
Fri, 7 Jan 2022 12:55:38 +0000 (13:55 +0100)
committerJeremy Allison <jra@samba.org>
Mon, 10 Jan 2022 23:31:33 +0000 (23:31 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14941

Found by covscan.

Since capnew is initialized by NULL, checking it too early makes the
rest of the function a dead code.

Pair-programmed-with: Andreas Schneider <asn@samba.org>

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_cap.c

index 4a47b26c7b9a842620fed618292b9b8cd53547a7..43c8edb8932f62c67e54ad60122a64269ba23dc6 100644 (file)
@@ -448,7 +448,7 @@ static int cap_symlinkat(vfs_handle_struct *handle,
        int saved_errno = 0;
        int ret;
 
-       if (!capold || !capnew) {
+       if (capold == NULL) {
                errno = ENOMEM;
                return -1;
        }