linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: binfmt_script and ^M
@ 2001-02-27 13:42 Heusden, Folkert van
  2001-02-27 13:38 ` Ivo Timmermans
  2001-02-27 14:01 ` Bruce Harada
  0 siblings, 2 replies; 8+ messages in thread
From: Heusden, Folkert van @ 2001-02-27 13:42 UTC (permalink / raw)
  To: Ivo Timmermans, linux-kernel

> When running a script (perl in this case) that has DOS-style newlines
> (\r\n), Linux 2.4.2 can't find an interpreter because it doesn't
> recognize the \r.  The following patch should fix this (untested).

_should_ it work with the \r in it?

There might be a problem with your patch: at the '*)': if the '\n' is the
first character on the line, the cp-1 (which should be *(cp-1) I think)
would point before the buffer which can be un-allocated memory.



--- binfmt_script.c~	Mon Feb 26 17:42:09 2001
+++ binfmt_script.c	Tue Feb 27 13:39:47 2001
@@ -36,6 +36,8 @@
 	bprm->buf[BINPRM_BUF_SIZE - 1] = '\0';
 	if ((cp = strchr(bprm->buf, '\n')) == NULL)
 		cp = bprm->buf+BINPRM_BUF_SIZE-1;
+	if (cp - 1 == '\r')				<------- *)
+	  cp--;
 	*cp = '\0';
 	while (cp > bprm->buf) {
 		cp--;


Greetings,
Folkert van Heusden
[ www.vanheusden.com ]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2001-02-27 23:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-27 13:42 binfmt_script and ^M Heusden, Folkert van
2001-02-27 13:38 ` Ivo Timmermans
2001-02-27 19:20   ` Jamie Lokier
2001-02-27 19:59     ` Don Dugger
2001-02-27 21:36       ` [OT] " Tim Waugh
2001-02-27 23:16         ` Jamie Lokier
2001-02-27 21:35   ` Rogier Wolff
2001-02-27 14:01 ` Bruce Harada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).