[CRIU] [PATCH 1/2] zdtm/ia32: print st_size as (long long)
Dmitry Safonov
dsafonov at virtuozzo.com
Tue Apr 18 10:04:08 PDT 2017
Fixes compile-time errors on Fedora like:
In file included from unlink_fstat01.c:9:0:
> unlink_fstat01.c: In function ‘main’:
> ../lib/zdtmtst.h:123:11: error: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘__off64_t {aka long long int}’ [-Werror=format=]
> test_msg("FAIL: %s:%d: " format " (errno = %d (%s))\n", \
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
test/zdtm/static/autofs.c | 15 +++++++++------
test/zdtm/static/unlink_fstat01.c | 6 ++++--
test/zdtm/static/unlink_fstat02.c | 9 ++++++---
test/zdtm/static/unlink_fstat03.c | 9 ++++++---
4 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/test/zdtm/static/autofs.c b/test/zdtm/static/autofs.c
index 68a62940d929..747ab69dc024 100644
--- a/test/zdtm/static/autofs.c
+++ b/test/zdtm/static/autofs.c
@@ -220,18 +220,21 @@ static int check_fd(struct autofs_params *p)
ret++;
}
if (st.st_size != p->fd_stat.st_size) {
- pr_err("%s: st_size differs: %ld != %ld\n", p->mountpoint,
- st.st_size, p->fd_stat.st_size);
+ pr_err("%s: st_size differs: %lld != %lld\n", p->mountpoint,
+ (long long)st.st_size,
+ (long long)p->fd_stat.st_size);
ret++;
}
if (st.st_blksize != p->fd_stat.st_blksize) {
- pr_err("%s: st_blksize differs %ld != %ld:\n", p->mountpoint,
- (long)st.st_blksize, (long)p->fd_stat.st_blksize);
+ pr_err("%s: st_blksize differs %lld != %lld:\n", p->mountpoint,
+ (long long)st.st_blksize,
+ (long long)p->fd_stat.st_blksize);
ret++;
}
if (st.st_blocks != p->fd_stat.st_blocks) {
- pr_err("%s: st_blocks differs: %ld != %ld\n", p->mountpoint,
- st.st_blocks, p->fd_stat.st_blocks);
+ pr_err("%s: st_blocks differs: %lld != %lld\n", p->mountpoint,
+ (long long)st.st_blocks,
+ (long long)p->fd_stat.st_blocks);
ret++;
}
diff --git a/test/zdtm/static/unlink_fstat01.c b/test/zdtm/static/unlink_fstat01.c
index b82c8618b603..43ea6b9f6b2b 100644
--- a/test/zdtm/static/unlink_fstat01.c
+++ b/test/zdtm/static/unlink_fstat01.c
@@ -70,13 +70,15 @@ int main(int argc, char ** argv)
}
if (fst.st_size != fsize) {
- fail("(via fstat): file size changed to %ld", fst.st_size);
+ fail("(via fstat): file size changed to %lld",
+ (long long)fst.st_size);
goto failed;
}
fst.st_size = lseek(fd, 0, SEEK_END);
if (fst.st_size != fsize) {
- fail("(via lseek): file size changed to %ld", fst.st_size);
+ fail("(via lseek): file size changed to %lld",
+ (long long)fst.st_size);
goto failed;
}
diff --git a/test/zdtm/static/unlink_fstat02.c b/test/zdtm/static/unlink_fstat02.c
index ce32e9ecfa92..1ffeffd73cb9 100644
--- a/test/zdtm/static/unlink_fstat02.c
+++ b/test/zdtm/static/unlink_fstat02.c
@@ -47,7 +47,8 @@ int main(int argc, char ** argv)
}
if (fst.st_size != 0) {
- pr_perror("%s file size eq %ld", filename, fst.st_size);
+ pr_perror("%s file size eq %lld",
+ filename, (long long)fst.st_size);
goto failed;
}
@@ -86,13 +87,15 @@ int main(int argc, char ** argv)
}
if (fst.st_size != fsize) {
- fail("(via fstat): file size changed to %ld", fst.st_size);
+ fail("(via fstat): file size changed to %lld",
+ (long long)fst.st_size);
goto failed;
}
fst.st_size = lseek(fd[0], 0, SEEK_END);
if (fst.st_size != fsize) {
- fail("(via lseek): file size changed to %ld", fst.st_size);
+ fail("(via lseek): file size changed to %lld",
+ (long long)fst.st_size);
goto failed;
}
diff --git a/test/zdtm/static/unlink_fstat03.c b/test/zdtm/static/unlink_fstat03.c
index 8b3bf8dccf5f..b31ef19939a8 100644
--- a/test/zdtm/static/unlink_fstat03.c
+++ b/test/zdtm/static/unlink_fstat03.c
@@ -44,7 +44,8 @@ int main(int argc, char ** argv)
}
if (fst.st_size != 0) {
- pr_perror("%s file size eq %ld", filename, fst.st_size);
+ pr_perror("%s file size eq %lld", filename,
+ (long long)fst.st_size);
goto failed;
}
@@ -84,13 +85,15 @@ int main(int argc, char ** argv)
}
if (fst2.st_size != fsize) {
- fail("(via fstat): file size changed to %ld", fst.st_size);
+ fail("(via fstat): file size changed to %lld",
+ (long long)fst.st_size);
goto failed;
}
fst2.st_size = lseek(fd, 0, SEEK_END);
if (fst2.st_size != fsize) {
- fail("(via lseek): file size changed to %ld", fst.st_size);
+ fail("(via lseek): file size changed to %lld",
+ (long long)fst.st_size);
goto failed;
}
--
2.12.2
More information about the CRIU
mailing list