aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgto2023 <gto7052@mailbox.org>2023-07-13 13:59:24 +0200
committerMike Gilbert <floppym@gentoo.org>2023-08-05 16:07:55 -0400
commit7f230519475c2aaea91df75b0165d8b6c03b9fa9 (patch)
tree8b707bc2ec831a5bc533701c7a961dd023600409
parentsandbox: prevent possible use of uninitialized members of sandbox_info struct (diff)
downloadsandbox-7f230519475c2aaea91df75b0165d8b6c03b9fa9.tar.gz
sandbox-7f230519475c2aaea91df75b0165d8b6c03b9fa9.tar.bz2
sandbox-7f230519475c2aaea91df75b0165d8b6c03b9fa9.zip
sandbox: do not compare array to NULL
Fixes a compiler warning: ``` src/environ.c:211:19: warning: the comparison will always evaluate as ‘true’ for the address of ‘work_dir’ will never be NULL [-Waddress] ``` Bug: https://bugs.gentoo.org/906234 Signed-off-by: gto2023 <gto7052@mailbox.org> Signed-off-by: Mike Gilbert <floppym@gentoo.org>
-rw-r--r--src/environ.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/environ.c b/src/environ.c
index 81a3e5f..df8595b 100644
--- a/src/environ.c
+++ b/src/environ.c
@@ -208,7 +208,7 @@ static int setup_cfg_vars(struct sandbox_info_t *sandbox_info)
if (-1 == setup_access_var(ENV_SANDBOX_WRITE))
return -1;
if ((NULL == getenv(ENV_SANDBOX_WRITE)) &&
- (NULL != sandbox_info->work_dir))
+ strlen(sandbox_info->work_dir))
setenv(ENV_SANDBOX_WRITE, sandbox_info->work_dir, 1);
if (-1 == setup_access_var(ENV_SANDBOX_PREDICT))