Skip to content

Commit a174987

Browse files
committed
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
1 parent 9188b1f commit a174987

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

src/cmd/gopack/ar.c

+4
Original file line numberDiff line numberDiff line change
@@ -1430,6 +1430,10 @@ armalloc(int n)
14301430
{
14311431
char *cp;
14321432

1433+
// bump so that arwrite can do the same
1434+
if(n&1)
1435+
n++;
1436+
14331437
do {
14341438
cp = malloc(n);
14351439
if (cp) {

src/lib9/_p9dir.c

-13
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ disksize(int fd, int x)
4444
return 0;
4545
}
4646

47-
int _p9usepwlibrary = 1;
4847
/*
4948
* Caching the last group and passwd looked up is
5049
* 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 *
8988
sz += strlen(s)+1;
9089

9190
/* user */
92-
if(p && st->st_uid == uid && p->pw_uid == uid)
93-
;
94-
else if(_p9usepwlibrary){
95-
p = getpwuid(st->st_uid);
96-
uid = st->st_uid;
97-
}
9891
if(p == nil || st->st_uid != uid || p->pw_uid != uid){
9992
snprint(tmp, sizeof tmp, "%d", (int)st->st_uid);
10093
s = tmp;
@@ -112,12 +105,6 @@ _p9dir(struct stat *lst, struct stat *st, char *name, Dir *d, char **str, char *
112105
}
113106

114107
/* group */
115-
if(g && st->st_gid == gid && g->gr_gid == gid)
116-
;
117-
else if(_p9usepwlibrary){
118-
g = getgrgid(st->st_gid);
119-
gid = st->st_gid;
120-
}
121108
if(g == nil || st->st_gid != gid || g->gr_gid != gid){
122109
snprint(tmp, sizeof tmp, "%d", (int)st->st_gid);
123110
s = tmp;

0 commit comments

Comments
 (0)