From: Fredrik Tolf Date: Fri, 14 May 2021 14:06:07 +0000 (+0200) Subject: htparser: Allow PID-file, chuser and chroot arguments to be treated as NULL if empty. X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=eb174cf6ed3d71e9ed521733a139cb77338898c7;p=ashd.git htparser: Allow PID-file, chuser and chroot arguments to be treated as NULL if empty. --- 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);