summaryrefslogtreecommitdiffstats
path: root/bin/sh
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2013-08-30 10:45:02 +0000
committerjilles <jilles@FreeBSD.org>2013-08-30 10:45:02 +0000
commit415d59b5d8e4982f162fcff84c3f0514a99b8ada (patch)
treec20ca308c02016dea7bb08a75a1c33300adaccf1 /bin/sh
parent5a68ee8757ca1727e386a511decd12b06cc46466 (diff)
downloadFreeBSD-src-415d59b5d8e4982f162fcff84c3f0514a99b8ada.zip
FreeBSD-src-415d59b5d8e4982f162fcff84c3f0514a99b8ada.tar.gz
sh: Cast -1 to pointer rather than pointer to variable of wrong type.
NEOF needs to be a non-null pointer distinct from valid union node pointers. It is not dereferenced. The new NEOF is much like SIG_ERR except that it is an object pointer instead of a function pointer. The variable tokpushback can now be static.
Diffstat (limited to 'bin/sh')
-rw-r--r--bin/sh/parser.c2
-rw-r--r--bin/sh/parser.h6
2 files changed, 3 insertions, 5 deletions
diff --git a/bin/sh/parser.c b/bin/sh/parser.c
index 795e3ee..b23f455 100644
--- a/bin/sh/parser.c
+++ b/bin/sh/parser.c
@@ -96,7 +96,7 @@ static struct heredoc *heredoclist; /* list of here documents to read */
static int doprompt; /* if set, prompt the user */
static int needprompt; /* true if interactive and at start of line */
static int lasttoken; /* last token read */
-int tokpushback; /* last token pushed back */
+static int tokpushback; /* last token pushed back */
static char *wordtext; /* text of last word returned by readtoken */
static int checkkwd;
static struct nodelist *backquotelist;
diff --git a/bin/sh/parser.h b/bin/sh/parser.h
index b803f76..d500d2f 100644
--- a/bin/sh/parser.h
+++ b/bin/sh/parser.h
@@ -68,11 +68,9 @@
/*
* NEOF is returned by parsecmd when it encounters an end of file. It
- * must be distinct from NULL, so we use the address of a variable that
- * happens to be handy.
+ * must be distinct from NULL.
*/
-extern int tokpushback;
-#define NEOF ((union node *)&tokpushback)
+#define NEOF ((union node *)-1)
extern int whichprompt; /* 1 == PS1, 2 == PS2 */
extern const char *const parsekwd[];
OpenPOWER on IntegriCloud