diff options
author | Miles Bader <miles@gnu.org> | 1996-02-26 21:39:56 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1996-02-26 21:39:56 +0000 |
commit | a21e3cecc50bd1f7b551e1ab96d816b263c28832 (patch) | |
tree | 9c3426dd3fe7fae982c93f71ff65308c33e1e8b1 /exec/hashexec.c | |
parent | c5cf1cc3980180f93371d95d9af42eec90f185c7 (diff) |
(check_hashbang): Correctly deal with interpreter lines having no argument.
Diffstat (limited to 'exec/hashexec.c')
-rw-r--r-- | exec/hashexec.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/exec/hashexec.c b/exec/hashexec.c index 397f8a0a..11a6c19e 100644 --- a/exec/hashexec.c +++ b/exec/hashexec.c @@ -145,10 +145,18 @@ check_hashbang (struct execdata *e, /* Find the name of the interpreter. */ p = ibuf + strspn (ibuf, " \t"); interp = strsep (&p, " \t"); - /* Skip remaining blanks, and the rest of the line is the argument. */ - p += strspn (p, " \t"); - arg = p; - len = interp_len - (arg - ibuf); + + if (p) + /* Skip remaining blanks, and the rest of the line is the argument. */ + { + p += strspn (p, " \t"); + arg = p; + len = interp_len - (arg - ibuf); + } + else + /* There is no argument. */ + len = 0; + if (len == 0) arg = NULL; else |