[minicoredumper] Compile error in corestripper.c

Anders Wallin wallinux at gmail.com
Mon Apr 24 16:31:27 CEST 2017


The patch 28704e18d1656bdaf3e33558e0a148b666d7590d breaks the build.

gcc -DHAVE_CONFIG_H -I. -I../..  -Wall -D_GNU_SOURCE -D_LARGEFILE64_SOURCE
-Werror -I../../lib -I../../src/api -I../../src/common
-I../../src/libminicoredumper -DMCD_CONF_PATH=\"/usr/local/etc/minicore
dumper\"  -I/usr/include/json-c  -std=c99 -g -O2 -MT
minicoredumper-corestripper.o -MD -MP -MF
.deps/minicoredumper-corestripper.Tpo -c -o minicoredumper-corestripper.o
`test -f 'corestripper.c' || ech
o './'`corestripper.c
corestripper.c: In function ‘dump_compressed_tar’:
corestripper.c:1244:41: error: format ‘%lo’ expects argument of type ‘long
unsigned int’, but argument 4 has type ‘long long int’ [-Werror=format=]
  snprintf(hdr.mtime, sizeof(hdr.mtime), "%011lo",
                                         ^
corestripper.c:1244:41: error: format ‘%lo’ expects argument of type ‘long
unsigned int’, but argument 4 has type ‘long long int’ [-Werror=format=]

The following patch fix the problem;
>From 94f99f63eb7188ef74e953f6e98304af51e15c92 Mon Sep 17 00:00:00 2001
Message-Id: <
94f99f63eb7188ef74e953f6e98304af51e15c92.1493041764.git.anders.wallin at windriver.com
>
From: Anders Wallin <anders.wallin at windriver.com>
Date: Mon, 24 Apr 2017 15:48:02 +0200
Subject: [PATCH 1/2] using long long format when adding time to header

Signed-off-by: Anders Wallin <anders.wallin at windriver.com>
---
 src/minicoredumper/corestripper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/minicoredumper/corestripper.c
b/src/minicoredumper/corestripper.c
index 7d46af1..11e0df1 100644
--- a/src/minicoredumper/corestripper.c
+++ b/src/minicoredumper/corestripper.c
@@ -1241,7 +1241,7 @@ static int dump_compressed_tar(struct dump_info *di)
        snprintf(hdr.mode, sizeof(hdr.mode), "%07o", 0644);
        snprintf(hdr.uid, sizeof(hdr.uid), "%07o", 0);
        snprintf(hdr.gid, sizeof(hdr.gid), "%07o", 0);
-       snprintf(hdr.mtime, sizeof(hdr.mtime), "%011lo",
+       snprintf(hdr.mtime, sizeof(hdr.mtime), "%011llo",
                 (long long)time(NULL));
        memset(hdr.checksum, ' ', sizeof(hdr.checksum));
        hdr.type = 'S';
-- 
2.11.0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linutronix.de/pipermail/minicoredumper/attachments/20170424/3f510a71/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-using-long-long-format-when-adding-time-to-header.patch
Type: text/x-patch
Size: 1114 bytes
Desc: not available
URL: <http://lists.linutronix.de/pipermail/minicoredumper/attachments/20170424/3f510a71/attachment.bin>


More information about the minicoredumper mailing list