diff options
author | Guillem Jover <guillem@debian.org> | 2010-12-01 03:20:07 +0100 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2011-01-08 17:17:40 +0100 |
commit | 027c6e35be5cfb31cab3c3a286e2b4bc0763d161 (patch) | |
tree | 67213af1acfa4615ed58826d00020e28dd18f4c4 /dpkg-deb/extract.c | |
parent | e36ca74003e44e44faacbb9c32d596d80a9387f9 (diff) | |
download | dpkg-027c6e35be5cfb31cab3c3a286e2b4bc0763d161.tar.gz |
Use dpkg_ar_member_get_size() instead of duplicated code
Diffstat (limited to 'dpkg-deb/extract.c')
-rw-r--r-- | dpkg-deb/extract.c | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/dpkg-deb/extract.c b/dpkg-deb/extract.c index b71e28c8f..a44e75c61 100644 --- a/dpkg-deb/extract.c +++ b/dpkg-deb/extract.c @@ -99,28 +99,6 @@ read_line(int fd, char *buf, size_t min_size, size_t max_size) return line_size; } -static size_t -parseheaderlength(const char *inh, size_t len, - const char *fn, const char *what) -{ - char lintbuf[15]; - ssize_t r; - char *endp; - - if (memchr(inh,0,len)) - ohshit(_("file `%.250s' is corrupt - %.250s length contains nulls"),fn,what); - assert(sizeof(lintbuf) > len); - memcpy(lintbuf,inh,len); - lintbuf[len]= ' '; - *strchr(lintbuf, ' ') = '\0'; - r = strtol(lintbuf, &endp, 10); - if (r < 0) - ohshit(_("file `%.250s' is corrupt - negative member length %zi"), fn, r); - if (*endp) - ohshit(_("file `%.250s' is corrupt - bad digit (code %d) in %s"),fn,*endp,what); - return (size_t)r; -} - void extracthalf(const char *debar, const char *dir, const char *taroption, int admininfo) @@ -165,8 +143,7 @@ extracthalf(const char *debar, const char *dir, const char *taroption, if (memcmp(arh.ar_fmag,ARFMAG,sizeof(arh.ar_fmag))) ohshit(_("file `%.250s' is corrupt - bad magic at end of first header"),debar); - memberlen= parseheaderlength(arh.ar_size,sizeof(arh.ar_size), - debar, _("archive member size")); + memberlen = dpkg_ar_member_get_size(debar, &arh); if (!header_done) { char *infobuf; char *cur; |