diff options
-rw-r--r-- | rvnit.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/rvnit.c b/rvnit.c index 4fa1968..b35850b 100644 --- a/rvnit.c +++ b/rvnit.c @@ -555,8 +555,18 @@ next: ; } int -main() +main(int argc, char *argv[]) { + if (argc < 2) { + dprintf(2, "Usage: rvnit DIR\n"); + exit(2); + } + + if (chdir(argv[1]) < 0) { + perror("chdir"); + return 111; + } + pipe(selflogfd); fcntl(selflogfd[0], F_SETFL, O_NONBLOCK); fcntl(selflogfd[1], F_SETFL, O_NONBLOCK); @@ -584,11 +594,6 @@ main() pthread_create(&logger_thread, 0, logger_loop, 0); sigprocmask(SIG_UNBLOCK, &allset, 0); - if (chdir("sv") < 0) { - perror("chdir"); - return 111; - } - pthread_mutex_lock(&services_lock); rescandir(); pthread_mutex_unlock(&services_lock); |