aboutsummaryrefslogtreecommitdiff
path: root/archival/tar.c
diff options
context:
space:
mode:
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-11-24 14:57:31 +0000
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-11-24 14:57:31 +0000
commitaa2fdd67f50302aa6d6f3422f57ce5d42333c1f8 (patch)
tree45516e35a895fa4eccfb36ff0d8c1e29714a2c41 /archival/tar.c
parent708d74b5fe4e29c55f76b79bc71aa6ae532d38fe (diff)
downloadbusybox-w32-aa2fdd67f50302aa6d6f3422f57ce5d42333c1f8.tar.gz
busybox-w32-aa2fdd67f50302aa6d6f3422f57ce5d42333c1f8.tar.bz2
busybox-w32-aa2fdd67f50302aa6d6f3422f57ce5d42333c1f8.zip
tar: cache [ug]id->username/groupname mappings. Cuts down amount
of open/read/close of /etc/passwd and /etc/group dramatically (we were rereading those for each untarred file!!!) git-svn-id: svn://busybox.net/trunk/busybox@16654 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'archival/tar.c')
-rw-r--r--archival/tar.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/archival/tar.c b/archival/tar.c
index 99c4adb6a..51d34ea19 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -211,12 +211,9 @@ static int writeTarHeader(struct TarBallInfo *tbInfo,
211 putOctal(header.mtime, sizeof(header.mtime), statbuf->st_mtime); 211 putOctal(header.mtime, sizeof(header.mtime), statbuf->st_mtime);
212 strcpy(header.magic, "ustar "); 212 strcpy(header.magic, "ustar ");
213 213
214 /* Enter the user and group names (default to root if it fails) */ 214 /* Enter the user and group names */
215//cache!!! 215 safe_strncpy(header.uname, get_cached_username(statbuf->st_uid), sizeof(header.uname));
216 if (bb_getpwuid(header.uname, statbuf->st_uid, sizeof(header.uname)) == NULL) 216 safe_strncpy(header.gname, get_cached_groupname(statbuf->st_gid), sizeof(header.gname));
217 strcpy(header.uname, "root");
218 if (bb_getgrgid(header.gname, statbuf->st_gid, sizeof(header.gname)) == NULL)
219 strcpy(header.gname, "root");
220 217
221 if (tbInfo->hlInfo) { 218 if (tbInfo->hlInfo) {
222 /* This is a hard link */ 219 /* This is a hard link */