diff options
author | Mark Whitley | 2001-01-23 22:30:04 +0000 |
---|---|---|
committer | Mark Whitley | 2001-01-23 22:30:04 +0000 |
commit | 59ab025363d884deb2013dcaae6c968585a6ec72 (patch) | |
tree | 852d97bdc34c44dbcf29cc8b5cd9257a8c90f7b3 /rpmunpack.c | |
parent | 2b8d07c590249991fae975652aae86f5fca91f81 (diff) | |
download | busybox-59ab025363d884deb2013dcaae6c968585a6ec72.zip busybox-59ab025363d884deb2013dcaae6c968585a6ec72.tar.gz |
#define -> static const int. Also got rid of some big static buffers.
Diffstat (limited to 'rpmunpack.c')
-rw-r--r-- | rpmunpack.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/rpmunpack.c b/rpmunpack.c index 249d223..512d638 100644 --- a/rpmunpack.c +++ b/rpmunpack.c @@ -19,7 +19,7 @@ /* * Some general definitions */ -#define BUFSIZE 512 + #define RPM_MAGIC "\355\253\356\333" #define GZ_MAGIC_1 '\037' #define GZ_MAGIC_2 '\213' @@ -27,14 +27,13 @@ /* * Global variables */ -static char buffer[BUFSIZE]; static char *progname; static int infile, outfile; /* * Read a specified number of bytes from input file */ -static void myread(int num) +static void myread(int num, char *buffer) { int err; @@ -52,6 +51,7 @@ static void myread(int num) int rpmunpack_main(int argc, char **argv) { int len, status = 0; + char buffer[BUFSIZ]; /* Get our own program name */ if ((progname = strrchr(argv[0], '/')) == NULL) @@ -71,13 +71,13 @@ int rpmunpack_main(int argc, char **argv) perror_msg_and_die("%s", argv[1]); /* Read magic ID and output filename */ - myread(4); + myread(4, buffer); if (strncmp(buffer, RPM_MAGIC, 4)) { fprintf(stderr, "Input file is not in RPM format!\n"); exit(1); } - myread(6); /* Skip flags */ - myread(64); + myread(6, buffer); /* Skip flags */ + myread(64, buffer); buffer[64] = '\0'; /* Open output file */ @@ -97,9 +97,9 @@ int rpmunpack_main(int argc, char **argv) * never appears before offset 0x200, so we skip these first couple of * bytes to make the signature scan a little more reliable. */ - myread(0x200 - 74); + myread(0x200 - 74, buffer); while (status < 2) { - myread(1); + myread(1, buffer); if (status == 0 && buffer[0] == GZ_MAGIC_1) status++; else if (status == 1 && buffer[0] == GZ_MAGIC_2) @@ -113,7 +113,7 @@ int rpmunpack_main(int argc, char **argv) perror_msg_and_die("write"); /* Now simply copy the GZIP archive into the output file */ - while ((len = read(infile, buffer, BUFSIZE)) > 0) { + while ((len = read(infile, buffer, BUFSIZ)) > 0) { if (write(outfile, buffer, len) < 0) perror_msg_and_die("write"); } |