doc: Documented htpipe.
[ashd.git] / src / htparser.c
index 348a940..e281abd 100644 (file)
@@ -607,7 +607,7 @@ int main(int argc, char **argv)
     struct passwd *pwent;
     
     daemonize = usesyslog = 0;
-    root = NULL;
+    root = pidfile = NULL;
     pwent = NULL;
     while((c = getopt(argc, argv, "+hSfu:r:p:")) >= 0) {
        switch(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);