Less would segfault if it had no tty. (Bug 600.)
authorRob Landley <rob@landley.net>
Fri, 16 Dec 2005 08:02:11 +0000 (08:02 -0000)
committerRob Landley <rob@landley.net>
Fri, 16 Dec 2005 08:02:11 +0000 (08:02 -0000)
miscutils/less.c

index 0b0dc0c8bbd7244915a8eda90a81001b0f95c662..19051f6f61111029c3207abac9fb5320f42fa3b0 100644 (file)
@@ -239,6 +239,7 @@ static void data_readlines(void) {
 
        if(inp == NULL)
                inp = (inp_stdin) ? bb_xfopen(CURRENT_TTY, "r") : stdin;
+       if(inp == NULL) bb_perror_msg_and_die("no tty");
 
        if (flags & FLAG_N)
                add_linenumbers();