summaryrefslogtreecommitdiff
path: root/dpkg-split
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2010-07-01 12:05:09 +0200
committerGuillem Jover <guillem@debian.org>2010-07-03 07:09:46 +0200
commitc81a1475db83f6fbd33a104085434f71d9761c74 (patch)
treef0d5c05b0fd521969b6cc41747ff34f8ff659da6 /dpkg-split
parent84182faf902d1b7ba0ed13554e42d5ca40763bd2 (diff)
downloaddpkg-c81a1475db83f6fbd33a104085434f71d9761c74.tar.gz
Use new DPKG_AR_MAGIC macro instead of literal string
Diffstat (limited to 'dpkg-split')
-rw-r--r--dpkg-split/info.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/dpkg-split/info.c b/dpkg-split/info.c
index 6b783f854..35d476c1f 100644
--- a/dpkg-split/info.c
+++ b/dpkg-split/info.c
@@ -84,7 +84,7 @@ struct partinfo *read_info(FILE *partfile, const char *fn, struct partinfo *ir)
size_t thisilen;
unsigned int templong;
- char magicbuf[SARMAG], *rip, *partnums, *slash;
+ char magicbuf[strlen(DPKG_AR_MAGIC)], *rip, *partnums, *slash;
struct ar_hdr arh;
int c;
struct stat stab;
@@ -92,7 +92,7 @@ struct partinfo *read_info(FILE *partfile, const char *fn, struct partinfo *ir)
if (fread(magicbuf, 1, sizeof(magicbuf), partfile) != sizeof(magicbuf)) {
if (ferror(partfile)) rerr(fn); else return NULL;
}
- if (memcmp(magicbuf, "!<arch>\n", sizeof(magicbuf)))
+ if (memcmp(magicbuf, DPKG_AR_MAGIC, sizeof(magicbuf)))
return NULL;
if (fread(&arh,1,sizeof(arh),partfile) != sizeof(arh)) rerreof(partfile,fn);
@@ -173,9 +173,9 @@ struct partinfo *read_info(FILE *partfile, const char *fn, struct partinfo *ir)
? ir->orglength - ir->thispartoffset : ir->maxpartlen))
ohshit(_("file `%.250s' is corrupt - size is wrong for quoted part number"),fn);
- ir->filesize= (SARMAG +
- sizeof(arh) + thisilen + (thisilen&1) +
- sizeof(arh) + ir->thispartlen + (ir->thispartlen&1));
+ ir->filesize = (strlen(DPKG_AR_MAGIC) +
+ sizeof(arh) + thisilen + (thisilen & 1) +
+ sizeof(arh) + ir->thispartlen + (ir->thispartlen & 1));
if (fstat(fileno(partfile),&stab)) ohshite(_("unable to fstat part file `%.250s'"),fn);
if (S_ISREG(stab.st_mode)) {
@@ -186,7 +186,8 @@ struct partinfo *read_info(FILE *partfile, const char *fn, struct partinfo *ir)
ohshit(_("file `%.250s' is corrupt - too short"),fn);
}
- ir->headerlen= SARMAG + sizeof(arh) + thisilen + (thisilen&1) + sizeof(arh);
+ ir->headerlen = strlen(DPKG_AR_MAGIC) +
+ sizeof(arh) + thisilen + (thisilen & 1) + sizeof(arh);
return ir;
}