sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit 8e016fad91221f108ef11df65516db98173ec34e
parent eb17f2cc9cae2b6865dd849c23c7ec135a72b504
Author: FRIGN <dev@frign.de>
Date:   Mon, 16 Feb 2015 20:01:33 +0100

Make the tar(1)-header fixed again

This is clearer.

Diffstat:
Mtar.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tar.c b/tar.c @@ -21,8 +21,8 @@ struct header { char chksum[8]; char type; char link[100]; - char *magic; - char *version; + char magic[6]; + char version[2]; char uname[32]; char gname[32]; char major[8]; @@ -111,8 +111,8 @@ archive(const char* path) putoctal(h->gid, (unsigned)st.st_gid, sizeof(h->gid)); putoctal(h->size, 0, sizeof(h->size)); putoctal(h->mtime, (unsigned)st.st_mtime, sizeof(h->mtime)); - h->magic = "ustar"; - h->version = "00"; + memcpy(h->magic, "ustar", sizeof(h->magic)); + memcpy(h->version, "00", sizeof(h->version)); snprintf(h->uname, sizeof h->uname, "%s", pw ? pw->pw_name : ""); snprintf(h->gname, sizeof h->gname, "%s", gr ? gr->gr_name : "");