home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / linux / 21784 < prev    next >
Encoding:
Text File  |  1992-12-26  |  1.9 KB  |  59 lines

  1. Newsgroups: comp.os.linux
  2. Path: sparky!uunet!world!jrs
  3. From: jrs@world.std.com (Rick Sladkey)
  4. Subject: Re: getpwnami, 4.2 & login, perl ... (was Re: UUCP 103 (taylor))
  5. In-Reply-To: amartell@nyx.cs.du.edu's message of Sat, 26 Dec 92 21:02:30 GMT
  6. Message-ID: <JRS.92Dec26222406@lepton.world.std.com>
  7. Sender: jrs@world.std.com (Rick Sladkey)
  8. Organization: The Internet
  9. References: <724981623snx@weasel.demon.co.uk> <72424@cup.portal.com>
  10.     <1992Dec26.155518.21255@r-node.gts.org>
  11.     <1992Dec26.210230.3632@mnemosyne.cs.du.edu>
  12. Date: Sun, 27 Dec 1992 03:24:06 GMT
  13. Lines: 44
  14.  
  15. >>>>> On Sat, 26 Dec 92 21:02:30 GMT,
  16. >>>>> amartell@nyx.cs.du.edu (Alex Martelli) said:
  17.  
  18. Alex> I wanted to use perl for the patching as I always did on other
  19. Alex> Unices (with a -pi switch and a single s/libc.so.4/libc.so.O/;
  20. Alex> instruction) BUT it doesn't work here: it truncates the input
  21. Alex> file to the first binary 0 byte, so login becomes only 3 bytes
  22. Alex> long... is it a bug in the fread() from stdio?  Apparently it's
  23. Alex> the reading that makes perl truncate at the 0 byte (it works
  24. Alex> with sysread then syswrite, though it's less convenient).
  25.  
  26. This is a bug in perl.  It occurs with Linux because Linux has
  27. non-standard stdio (iostream) and perl mishandles null characters
  28. in this situation.  Here is the patch I just sent to Larry.
  29. -----
  30. *** str.c.orig    Fri Jun 12 01:46:27 1992
  31. --- str.c    Sat Dec 26 22:18:21 1992
  32. ***************
  33. *** 863,873 ****
  34.       bp = buf;
  35.       while ((i = getc(fp)) != EOF && (*bp++ = i) != newline && bp < bpe) ;
  36.   
  37. -     *bp = '\0';
  38.       if (append)
  39. !         str_cat(str, buf);
  40.       else
  41. !         str_set(str, buf);
  42.       if (i != EOF            /* joy */
  43.           &&
  44.           (i != newline
  45. --- 863,872 ----
  46.       bp = buf;
  47.       while ((i = getc(fp)) != EOF && (*bp++ = i) != newline && bp < bpe) ;
  48.   
  49.       if (append)
  50. !         str_ncat(str, buf, bp - buf);
  51.       else
  52. !         str_nset(str, buf, bp - buf);
  53.       if (i != EOF            /* joy */
  54.           &&
  55.           (i != newline
  56. --
  57. Rick Sladkey
  58. jrs@world.std.com
  59.