mirror of
https://github.com/systemd/systemd.git
synced 2025-03-14 04:58:28 +03:00
ptyfwd-tool: don't segfault if called without arguments
This commit is contained in:
parent
a932d2f23e
commit
40e22609e8
@ -108,6 +108,9 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
if (optind >= argc)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Expected command line, refusing.");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -156,6 +159,8 @@ static int run(int argc, char *argv[]) {
|
||||
if (!l)
|
||||
return log_oom();
|
||||
|
||||
assert_se(!strv_isempty(l));
|
||||
|
||||
r = sd_event_default(&event);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to get event loop: %m");
|
||||
|
Loading…
x
Reference in New Issue
Block a user