gcc-9.x warning fixes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2020-10-01 03:07:22 +02:00
parent aaa0709e7b
commit 4a0eb0370c
9 changed files with 15 additions and 12 deletions

View File

@@ -297,7 +297,8 @@ static void writeLongname(int fd, int type, const char *name, int dir)
header.typeflag = type;
strcpy(header.name, "././@LongLink");
/* This sets mode/uid/gid/mtime to "00...00<NUL>" strings */
memset(header.mode, '0', sizeof(struct prefilled));
memset((char*)&header + offsetof(struct tar_header_t, mode), /* make gcc-9.x happy */
'0', sizeof(struct prefilled));
header.mode [sizeof(header.mode ) - 1] = '\0';
header.uid [sizeof(header.uid ) - 1] = '\0';
header.gid [sizeof(header.gid ) - 1] = '\0';