diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2022-01-02 08:15:52 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2022-01-02 08:15:52 +0000 |
| commit | 99ebff5a515c4645e2faa32fd51e975e60d95ddb (patch) | |
| tree | 5084aa2a518cdac3536517c8c976c1dfedd11bb4 /client.c | |
| parent | doc: ctlseq: add missing ‘[‘ to a couple of CSI sequences (diff) | |
| parent | changelog: 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.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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); |
