Article View: comp.sys.sun
Article #11146Re: strange nfs/yp/filec bug (patch included)
From: Craig Leres
Date: Tue, 28 Feb 1989 05:03
Date: Tue, 28 Feb 1989 05:03
78 lines
2567 bytes
2567 bytes
The csh file completion problem Tom Gorodecki mentions was recently
discussed by Alexander Dupuy. The problem is that the yp code in
gethostbyname() and friends is broken; unless setpwent() is used to
specify that lots of accesses are going to occur, the connection to the yp
server should be closed after every use.
Appended are context diffs to the 3.5 csh which result from the change
Alexander Dupuy suggests. One other problem of this type is also
corrected. Source indicates that 4.0 suffers from this bug.
Craig
------
RCS file: RCS/sh.c,v
retrieving revision 1.1
diff -c -r1.1 sh.c
*** /tmp/,RCSt1a00437 Wed Jan 11 20:31:20 1989
--- sh.c Wed Jan 11 20:21:11 1989
***************
*** 883,889 ****
char *home;
{
register struct passwd *pp = getpwnam(home);
!
if (pp == 0)
return (1);
(void) strcpy(home, pp->pw_dir);
--- 883,892 ----
char *home;
{
register struct passwd *pp = getpwnam(home);
! char name[256];
!
! getdomainname(name, sizeof(name));
! yp_unbind(name);
if (pp == 0)
return (1);
(void) strcpy(home, pp->pw_dir);
RCS file: RCS/sh.file.c,v
retrieving revision 1.1
diff -c -r1.1 sh.file.c
*** /tmp/,RCSt1a00442 Wed Jan 11 20:31:24 1989
--- sh.file.c Wed Jan 11 20:21:56 1989
***************
*** 296,302 ****
--- 296,306 ----
if (person[0] == '\0')
(void) strcpy(new, value("home"));
else {
+ char name[256];
+
pw = getpwnam(person);
+ getdomainname(name, sizeof(name));
+ yp_unbind(name);
if (pw == NULL)
return (NULL);
(void) strcpy(new, pw->pw_dir);
***************
*** 379,385 ****
register struct direct *dirp;
if (looking_for_lognames) {
! if ((pw = getpwent ()) == NULL)
return (NULL);
return (pw->pw_name);
}
--- 383,393 ----
register struct direct *dirp;
if (looking_for_lognames) {
! char name[256];
! pw = getpwent ();
! getdomainname(name, sizeof(name));
! yp_unbind(name);
! if (pw == NULL)
return (NULL);
return (pw->pw_name);
}
Technical Details
Message-ID:
<8901120433.AA00448@helios.ee.lbl.gov>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-requestShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request From: leres@helios.ee.lbl.gov (Craig Leres) Newsgroups: comp.sys.sun Subject: Re: strange nfs/yp/filec bug (patch included) Message-ID: <8901120433.AA00448@helios.ee.lbl.gov> Date: 28 Feb 89 05:03:23 GMT Sender: usenet@rice.edu Organization: Sun-Spots Lines: 78 Approved: Sun-Spots@rice.edu Original-Date: Wed, 11 Jan 89 20:33:54 PST X-Sun-Spots-Digest: Volume 7, Issue 170, message 4 of 12