From: Russ Cox Date: Wed, 11 Nov 2009 22:48:33 +0000 (-0800) Subject: two gopack nits. X-Git-Tag: weekly.2009-11-12~24 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a174987a7c137f3c76f30a32a5429a4060dcd4b2;p=gostls13.git 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 --- diff --git a/src/cmd/gopack/ar.c b/src/cmd/gopack/ar.c index b8e5cdd317..d8f2d4800f 100644 --- a/src/cmd/gopack/ar.c +++ b/src/cmd/gopack/ar.c @@ -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) { diff --git a/src/lib9/_p9dir.c b/src/lib9/_p9dir.c index 733defe303..ededa0a92e 100644 --- a/src/lib9/_p9dir.c +++ b/src/lib9/_p9dir.c @@ -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;