1
0
mirror of https://github.com/golang/go synced 2024-11-12 09:20:22 -07:00

two gopack nits.

1. allocate an extra byte for use by write.
2. throw away the code trying to translate
   uid and gid to names.  i suspect it of causing
   seg faults in some situations, and it is
   not needed by the compilers.

Fixes #48.  (I hope.)

R=r
https://golang.org/cl/152077
This commit is contained in:
Russ Cox 2009-11-11 14:48:33 -08:00
parent 9188b1f000
commit a174987a7c
2 changed files with 4 additions and 13 deletions

View File

@ -1430,6 +1430,10 @@ armalloc(int n)
{
char *cp;
// bump so that arwrite can do the same
if(n&1)
n++;
do {
cp = malloc(n);
if (cp) {

View File

@ -44,7 +44,6 @@ disksize(int fd, int x)
return 0;
}
int _p9usepwlibrary = 1;
/*
* Caching the last group and passwd looked up is
* a significant win (stupidly enough) on most systems.
@ -89,12 +88,6 @@ _p9dir(struct stat *lst, struct stat *st, char *name, Dir *d, char **str, char *
sz += strlen(s)+1;
/* user */
if(p && st->st_uid == uid && p->pw_uid == uid)
;
else if(_p9usepwlibrary){
p = getpwuid(st->st_uid);
uid = st->st_uid;
}
if(p == nil || st->st_uid != uid || p->pw_uid != uid){
snprint(tmp, sizeof tmp, "%d", (int)st->st_uid);
s = tmp;
@ -112,12 +105,6 @@ _p9dir(struct stat *lst, struct stat *st, char *name, Dir *d, char **str, char *
}
/* group */
if(g && st->st_gid == gid && g->gr_gid == gid)
;
else if(_p9usepwlibrary){
g = getgrgid(st->st_gid);
gid = st->st_gid;
}
if(g == nil || st->st_gid != gid || g->gr_gid != gid){
snprint(tmp, sizeof tmp, "%d", (int)st->st_gid);
s = tmp;