svn commit: trunk/busybox/archival

Bernhard Fischer rep.nop at aon.at
Mon Sep 11 08:10:53 UTC 2006


On Sat, Sep 09, 2006 at 08:20:38PM -0700, landley at busybox.net wrote:
>Author: landley
>Date: 2006-09-09 20:20:37 -0700 (Sat, 09 Sep 2006)
>New Revision: 16090
>
>Log:
>Cleanup headers and replace the zero padding with an even smaller version.
>One of the pads turned out to be unnecessary: sizeof(struct TarHeader) is
>TAR_BLOCK_SIZE, the padding's in the struct.  The others could be done inline
>with bb_common_bufsiz1.
>
>This is a cleanup I did to Denis' patch long ago, but got sidetracked by
>what turned into svn 15660.
>
>
>Modified:
>   trunk/busybox/archival/tar.c
>
>
>Changeset:
>Modified: trunk/busybox/archival/tar.c
>===================================================================
>--- trunk/busybox/archival/tar.c	2006-09-09 22:35:00 UTC (rev 16089)
>+++ trunk/busybox/archival/tar.c	2006-09-10 03:20:37 UTC (rev 16090)

>@@ -221,7 +190,7 @@
> 	const unsigned char *cp = (const unsigned char *) &header;
> 	ssize_t size = sizeof(struct TarHeader);
> 
>-	memset(&header, 0, size);
>+	bzero(&header, size);

Please do NOT re-introduce deprecated functions!
bzero is deprecated and flagged as LEGACY in POSIX.1-2001; See also
"issue 6" in
http://www.opengroup.org/onlinepubs/009695399/functions/bzero.html

> 
> 	safe_strncpy(header.name, header_name, sizeof(header.name));
> 
>@@ -288,14 +257,7 @@
> 	putOctal(header.chksum, 7, chksum);
> 
> 	/* Now write the header out to disk */
>-	size = full_write(tbInfo->tarFd, (char *) &header,
>-					sizeof(struct TarHeader));
>-	if (size < 0) {
>-		bb_error_msg(bb_msg_io_error, fileName);
>-		return FALSE;
>-	}
>-	/* Pad the header up to the tar block size */
>-	size = pad_block_write(tbInfo->tarFd, size);
>+	xwrite(tbInfo->tarFd, &header, sizeof(struct TarHeader));

You're certainly more familiar with tar, but is xwrite() a good idea
here? Do we now create foobared .tar's ?



More information about the busybox mailing list