mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 08:25:20 +09:00
ptyfwd-tool: don't segfault if called without arguments
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user