From eb174cf6ed3d71e9ed521733a139cb77338898c7 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Fri, 14 May 2021 16:06:07 +0200 Subject: [PATCH] htparser: Allow PID-file, chuser and chroot arguments to be treated as NULL if empty. --- src/htparser.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/htparser.c b/src/htparser.c index 348a940..b7435b9 100644 --- a/src/htparser.c +++ b/src/htparser.c @@ -621,16 +621,16 @@ int main(int argc, char **argv) usesyslog = 1; break; case 'u': - if((pwent = getpwnam(optarg)) == NULL) { + if(optarg[0] && ((pwent = getpwnam(optarg)) == NULL)) { flog(LOG_ERR, "could not find user %s", optarg); exit(1); } break; case 'r': - root = optarg; + root = optarg[0] ? optarg : NULL; break; case 'p': - pidfile = optarg; + pidfile = optarg[0] ? optarg : NULL; break; default: usage(stderr); -- 2.11.0