diff options
author | Daniel Golle <daniel@makrotopia.org> | 2021-08-23 17:47:23 +0100 |
---|---|---|
committer | Daniel Golle <daniel@makrotopia.org> | 2021-08-24 18:31:35 +0100 |
commit | 3edb7ebecb266db545fe2e79ef552a9b09beaa6f (patch) | |
tree | 2969fc4b0bd91204e1c87f41b0a35006420f7dd0 /jail | |
parent | 0603c8d5b0039d28ba1ac6ce64a6a5814aa0bf24 (diff) | |
download | procd-3edb7ebecb266db545fe2e79ef552a9b09beaa6f.tar.gz |
jail: check return value when opening console
Coverity CID: 1490048 Argument cannot be negative
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'jail')
-rw-r--r-- | jail/jail.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/jail/jail.c b/jail/jail.c index 24a3df3..43a694a 100644 --- a/jail/jail.c +++ b/jail/jail.c @@ -395,6 +395,9 @@ static int create_dev_console(const char *jail_root) /* use PTY slave for stdio */ slave_console_fd = open(console_fname, O_RDWR); /* | O_NOCTTY */ + if (slave_console_fd < 0) + goto no_console; + dup2(slave_console_fd, 0); dup2(slave_console_fd, 1); dup2(slave_console_fd, 2); |