From f1107b0e17ae524707fc852b4d99c5baefd01161 Mon Sep 17 00:00:00 2001 From: illiliti Date: Tue, 18 May 2021 20:15:33 +0300 Subject: [PATCH] contrib/helper.c: minor fixes Exit with 2 if arguments are invalid. Compare unneeded environment variables with '=' delimiter to avoid false positives. --- contrib/helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/helper.c b/contrib/helper.c index 0a45edf..f2f3c50 100644 --- a/contrib/helper.c +++ b/contrib/helper.c @@ -33,7 +33,7 @@ int main(int argc, char **argv) break; default: fprintf(stderr, "usage: %s [dir]\n", argv[0]); - return 1; + return 2; } snprintf(path, sizeof(path), "%s/uevent.XXXXXX", dir); @@ -45,8 +45,8 @@ int main(int argc, char **argv) } for (i = 0; environ[i]; i++) { - if (strncmp(environ[i], "PATH", 4) == 0 || - strncmp(environ[i], "HOME", 4) == 0) { + if (strncmp(environ[i], "PATH=", 5) == 0 || + strncmp(environ[i], "HOME=", 5) == 0) { continue; }