also accept a carriage return as end of shebang line;
helps to at least not get messages like | sysop@odem2k:~/mb $ ./foo.sh | : No such file or directory | 127|sysop@odem2k:~/mb $ _ if you forgot to convert CR-LF into LF (of course only if the kernel fails with ENOEXEC – an ENOENT would not help in these cases), but of course other things will fail
This commit is contained in:
parent
dc71f9b775
commit
12b2011a96
6
exec.c
6
exec.c
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.27 2007/04/15 12:09:57 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.28 2007/04/17 21:26:34 tg Exp $");
|
||||||
|
|
||||||
static int comexec(struct op *, struct tbl *volatile, const char **,
|
static int comexec(struct op *, struct tbl *volatile, const char **,
|
||||||
int volatile);
|
int volatile);
|
||||||
@ -693,10 +693,10 @@ scriptexec(struct op *tp, const char **ap)
|
|||||||
/* read error -> no good */
|
/* read error -> no good */
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
close(fd);
|
close(fd);
|
||||||
/* scan for newline or NUL _before_ end of buffer */
|
/* scan for newline (or CR) or NUL _before_ end of buffer */
|
||||||
cp = (unsigned char *)buf;
|
cp = (unsigned char *)buf;
|
||||||
while ((char *)cp < (buf + sizeof (buf)))
|
while ((char *)cp < (buf + sizeof (buf)))
|
||||||
if (*cp == '\0' || *cp == '\n') {
|
if (*cp == '\0' || *cp == '\n' || *cp == '\r') {
|
||||||
*cp = '\0';
|
*cp = '\0';
|
||||||
break;
|
break;
|
||||||
} else
|
} else
|
||||||
|
Loading…
Reference in New Issue
Block a user