swc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/swc
Log | Files | Refs | README | LICENSE

commit 21de9f4416426f11d1164b626aac191448f9608a
parent b189935d7f172f23ee93cd3239bc1630e20669be
Author: Jonathan Glines <auntieNeo@gmail.com>
Date:   Thu,  5 Feb 2015 12:28:34 -0700

Prevent segfault when ttyname() has an error.

Diffstat:
Mlaunch/launch.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/launch/launch.c b/launch/launch.c @@ -328,8 +328,10 @@ static void find_vt(char * vt, size_t size) static int open_tty(const char * tty_name) { + char * stdin_tty; + /* Check if we are running on the desired VT */ - if (strcmp(tty_name, ttyname(STDIN_FILENO)) == 0) + if ((stdin_tty = ttyname(STDIN_FILENO)) && strcmp(tty_name, stdin_tty) == 0) return STDIN_FILENO; else {