Change order of conditional so that a possible null pointer is not
dereferenced. This case would only occur when stdin was not a tty. Thanks to Dan Muntz for discovering this bug.
This commit is contained in:
parent
a66bb8995a
commit
d655636830
@ -39,7 +39,7 @@ char copyright[] =
|
||||
|
||||
#ifndef lint
|
||||
/*static char sccsid[] = "from: @(#)rm.c 4.26 (Berkeley) 3/10/91";*/
|
||||
static char rcsid[] = "$Id: rm.c,v 1.11 1993/11/16 23:59:17 jtc Exp $";
|
||||
static char rcsid[] = "$Id: rm.c,v 1.12 1993/11/29 22:39:19 jtc Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <stdio.h>
|
||||
@ -266,7 +266,7 @@ check(path, name, sp)
|
||||
* talking to a terminal, ask. Symbolic links are excluded
|
||||
* because their permissions are meaningless.
|
||||
*/
|
||||
if (S_ISLNK(sp->st_mode) || !stdin_ok || !access(name, W_OK))
|
||||
if (!stdin_ok || S_ISLNK(sp->st_mode) || !access(name, W_OK))
|
||||
return(1);
|
||||
strmode(sp->st_mode, modep);
|
||||
(void)fprintf(stderr, "override %s%s%s/%s for %s? ",
|
||||
|
Loading…
Reference in New Issue
Block a user