home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.linux
- Path: sparky!uunet!world!jrs
- From: jrs@world.std.com (Rick Sladkey)
- Subject: Re: getpwnami, 4.2 & login, perl ... (was Re: UUCP 103 (taylor))
- In-Reply-To: amartell@nyx.cs.du.edu's message of Sat, 26 Dec 92 21:02:30 GMT
- Message-ID: <JRS.92Dec26222406@lepton.world.std.com>
- Sender: jrs@world.std.com (Rick Sladkey)
- Organization: The Internet
- References: <724981623snx@weasel.demon.co.uk> <72424@cup.portal.com>
- <1992Dec26.155518.21255@r-node.gts.org>
- <1992Dec26.210230.3632@mnemosyne.cs.du.edu>
- Date: Sun, 27 Dec 1992 03:24:06 GMT
- Lines: 44
-
- >>>>> On Sat, 26 Dec 92 21:02:30 GMT,
- >>>>> amartell@nyx.cs.du.edu (Alex Martelli) said:
-
- Alex> I wanted to use perl for the patching as I always did on other
- Alex> Unices (with a -pi switch and a single s/libc.so.4/libc.so.O/;
- Alex> instruction) BUT it doesn't work here: it truncates the input
- Alex> file to the first binary 0 byte, so login becomes only 3 bytes
- Alex> long... is it a bug in the fread() from stdio? Apparently it's
- Alex> the reading that makes perl truncate at the 0 byte (it works
- Alex> with sysread then syswrite, though it's less convenient).
-
- This is a bug in perl. It occurs with Linux because Linux has
- non-standard stdio (iostream) and perl mishandles null characters
- in this situation. Here is the patch I just sent to Larry.
- -----
- *** str.c.orig Fri Jun 12 01:46:27 1992
- --- str.c Sat Dec 26 22:18:21 1992
- ***************
- *** 863,873 ****
- bp = buf;
- while ((i = getc(fp)) != EOF && (*bp++ = i) != newline && bp < bpe) ;
-
- - *bp = '\0';
- if (append)
- ! str_cat(str, buf);
- else
- ! str_set(str, buf);
- if (i != EOF /* joy */
- &&
- (i != newline
- --- 863,872 ----
- bp = buf;
- while ((i = getc(fp)) != EOF && (*bp++ = i) != newline && bp < bpe) ;
-
- if (append)
- ! str_ncat(str, buf, bp - buf);
- else
- ! str_nset(str, buf, bp - buf);
- if (i != EOF /* joy */
- &&
- (i != newline
- --
- Rick Sladkey
- jrs@world.std.com
-