it's wrong to use strchr(s, 0) to look for the NUL byte, because in some environments it apparently might return NULL use new macro strnul = s+strlen(s) instead (not side-effect safe tho)
This commit is contained in:
4
lex.c
4
lex.c
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.31 2007/05/13 18:07:22 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.32 2007/05/13 19:14:04 tg Exp $");
|
||||
|
||||
/* Structure to keep track of the lexing state and the various pieces of info
|
||||
* needed for each particular state. */
|
||||
@@ -886,7 +886,7 @@ getsc__(void)
|
||||
source->flags |= s->flags & SF_ALIAS;
|
||||
s = source;
|
||||
} else if (*s->u.tblp->val.s &&
|
||||
ksh_isspace(strchr(s->u.tblp->val.s, 0)[-1])) {
|
||||
ksh_isspace(strnul(s->u.tblp->val.s)[-1])) {
|
||||
source = s = s->next; /* pop source stack */
|
||||
/* Note that this alias ended with a space,
|
||||
* enabling alias expansion on the following
|
||||
|
Reference in New Issue
Block a user