commit: ddca321beba086ebd3e44975f4c586ee0fa75dd5
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Feb 2 04:59:44 2026 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Feb 6 01:45:15 2026 +0000
URL:
https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=ddca321b
shquote: don't measure the length of POSIXLY_CORRECT
Where getenv("POSIXLY_CORRECT") returns a pointer to a string, there is
no need to calculate its length. Instead, check whether it begins with
something other than its terminating null character.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
shquote.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/shquote.c b/shquote.c
index e13d497..95f2f93 100644
--- a/shquote.c
+++ b/shquote.c
@@ -48,7 +48,7 @@ int
main(int argc, char *argv[])
{
char *var = getenv("POSIXLY_CORRECT");
- if (var != NULL && strlen(var))
+ if (var && *var)
/* Disallow dollar-single quoting. */
esc_mode = 1;