]> git.ipfire.org Git - thirdparty/samba.git/commit
lib:util: Move open() of /dev/null into the if-clause
authorAndreas Schneider <asn@samba.org>
Mon, 8 Jul 2024 08:14:39 +0000 (10:14 +0200)
committerGünther Deschner <gd@samba.org>
Tue, 16 Jul 2024 11:41:33 +0000 (11:41 +0000)
commitd21b8e057c8e28925750c154b1bc2ae645d57753
tree147bbae3162369e67a028c1dc50503c8ad29dba6
parentddadbddb401613258332359bc9c35069445070c9
lib:util: Move open() of /dev/null into the if-clause

"Error: RESOURCE_LEAK (CWE-772):
samba-4.20.0rc2/lib/util/close_low_fd.c:40: open_fn: Returning handle opened by ""open"". [Note: The source code implementation of the function has been overridden by a user model.]
samba-4.20.0rc2/lib/util/close_low_fd.c:40: var_assign: Assigning: ""dev_null"" = handle returned from ""open(""/dev/null"", 2, 0)"".
samba-4.20.0rc2/lib/util/close_low_fd.c:52: overwrite_var: Overwriting handle ""dev_null"" in ""dev_null = open(""/dev/null"", 2, 0)"" leaks the handle.
   50|    }
   51|
   52|->  dev_null = open(""/dev/null"", O_RDWR, 0);
   53|    if (dev_null == -1) {
   54|    dev_null = open(""/dev/null"", O_WRONLY, 0);"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
lib/util/close_low_fd.c