]> Cypherpunks repositories - gostls13.git/commitdiff
two gopack nits.
authorRuss Cox <rsc@golang.org>
Wed, 11 Nov 2009 22:48:33 +0000 (14:48 -0800)
committerRuss Cox <rsc@golang.org>
Wed, 11 Nov 2009 22:48:33 +0000 (14:48 -0800)
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

src/cmd/gopack/ar.c
src/lib9/_p9dir.c

index b8e5cdd317c5bd504542b083cd8cef6daea3acf3..d8f2d4800fa8448af6dddd1be22ad621cee50078 100644 (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) {
index 733defe30397bd99c6e27b0328ac70e5e14ada6a..ededa0a92e487de097f98615272fb66cdaab092f 100644 (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;