diff options
author | Russ Cox <rsc@golang.org> | 2009-11-11 14:48:33 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-11-11 14:48:33 -0800 |
commit | 8caea9add5dac1a0916c2ab81bd067c9a3a74cee (patch) | |
tree | 3f00c8c35d4676b63bc99ca58946842015468f1a | |
parent | 1be299f3155ab86636efa636571786267bf9ff9e (diff) | |
download | go-8caea9add5dac1a0916c2ab81bd067c9a3a74cee.tar.gz |
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 issue 48. (I hope.)
R=r
http://codereview.appspot.com/152077
-rw-r--r-- | src/cmd/gopack/ar.c | 4 | ||||
-rw-r--r-- | src/lib9/_p9dir.c | 13 |
2 files changed, 4 insertions, 13 deletions
diff --git a/src/cmd/gopack/ar.c b/src/cmd/gopack/ar.c index b8e5cdd31..d8f2d4800 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 733defe30..ededa0a92 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; |