aboutsummaryrefslogtreecommitdiff
path: root/client.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2022-01-02 08:15:52 +0000
committerDaniel Eklöf <daniel@ekloef.se>2022-01-02 08:15:52 +0000
commit99ebff5a515c4645e2faa32fd51e975e60d95ddb (patch)
tree5084aa2a518cdac3536517c8c976c1dfedd11bb4 /client.c
parentdoc: ctlseq: add missing ‘[‘ to a couple of CSI sequences (diff)
parentchangelog: fixed failing to launch when exec(3):ed with an empty argv (diff)
Merge branch 'argc-is-zero'
Diffstat (limited to 'client.c')
-rw-r--r--client.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/client.c b/client.c
index b6749835..df43e7d5 100644
--- a/client.c
+++ b/client.c
@@ -124,7 +124,7 @@ main(int argc, char *const *argv)
static const int foot_exit_failure = -36;
int ret = foot_exit_failure;
- const char *const prog_name = argv[0];
+ const char *const prog_name = argc > 0 ? argv[0] : "<nullptr>";
static const struct option longopts[] = {
{"term", required_argument, NULL, 't'},
@@ -309,8 +309,10 @@ main(int argc, char *const *argv)
}
}
- argc -= optind;
- argv += optind;
+ if (argc > 0) {
+ argc -= optind;
+ argv += optind;
+ }
log_init(log_colorize, false, LOG_FACILITY_USER, log_level);