diff options
-rw-r--r-- | seatd-launch/seatd-launch.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/seatd-launch/seatd-launch.c b/seatd-launch/seatd-launch.c index c362a15..1877c98 100644 --- a/seatd-launch/seatd-launch.c +++ b/seatd-launch/seatd-launch.c @@ -41,6 +41,12 @@ int main(int argc, char *argv[]) { } } + if (optind >= argc) { + fprintf(stderr, "A command must be specified\n\n%s", usage); + return 1; + } + char **command = &argv[optind]; + char sockbuf[256]; if (sockpath == NULL) { sprintf(sockbuf, "/tmp/seatd.%d.sock", getpid()); @@ -139,7 +145,7 @@ int main(int argc, char *argv[]) { goto error_seatd; } else if (child == 0) { setenv("SEATD_SOCK", sockpath, 1); - execvp(argv[1], &argv[1]); + execvp(command[0], command); perror("Could not start target"); _exit(1); } |