summaryrefslogtreecommitdiff
path: root/lib/libmtd.c
diff options
context:
space:
mode:
authorThorsten Glaser <tg@mirbsd.org>2018-09-21 01:22:11 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2018-10-02 14:00:28 +0200
commit64667fe63ba9dd78adb9c4abf04bc3e4e25a0fd7 (patch)
tree3b357842ca9b9411cff5e2df7db45aac1e838e2c /lib/libmtd.c
parent38a6e3e29d90e11c3d5147e609d7b8e021b2cabf (diff)
mtd-utils: Instead of doing preprocessor magic, just output off_t as long long
Fix warnings abot PRIdoff_t in libmtd.c, in mtd_read (and mtd_write): In file included from ../git/lib/libmtd.c:40:0: ../git/lib/libmtd.c: In function 'mtd_read': ../git/include/common.h:110:18: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'off_t {aka long long int}' [-Wformat=] ../git/include/common.h:120:2: note: in expansion of macro 'errmsg' errmsg(fmt, ##__VA_ARGS__); \ ^~~~~~ ../git/lib/libmtd.c:1082:10: note: in expansion of macro 'sys_errmsg' return sys_errmsg("cannot seek mtd%d to offset %"PRIdoff_t, ^~~~~~~~~~ /usr/lib/klibc/include/inttypes.h:28:17: note: format string is defined here #define PRId32 "d" Signed-off-by: Thorsten Glaser <tg@mirbsd.org> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/libmtd.c')
-rw-r--r--lib/libmtd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libmtd.c b/lib/libmtd.c
index 7382229..5e3ac50 100644
--- a/lib/libmtd.c
+++ b/lib/libmtd.c
@@ -1093,8 +1093,8 @@ int mtd_read(const struct mtd_dev_info *mtd, int fd, int eb, int offs,
/* Seek to the beginning of the eraseblock */
seek = (off_t)eb * mtd->eb_size + offs;
if (lseek(fd, seek, SEEK_SET) != seek)
- return sys_errmsg("cannot seek mtd%d to offset %"PRIdoff_t,
- mtd->mtd_num, seek);
+ return sys_errmsg("cannot seek mtd%d to offset %lld",
+ mtd->mtd_num, (long long)seek);
while (rd < len) {
ret = read(fd, buf + rd, len - rd);
@@ -1202,8 +1202,8 @@ int mtd_write(libmtd_t desc, const struct mtd_dev_info *mtd, int fd, int eb,
if (data) {
/* Seek to the beginning of the eraseblock */
if (lseek(fd, seek, SEEK_SET) != seek)
- return sys_errmsg("cannot seek mtd%d to offset %"PRIdoff_t,
- mtd->mtd_num, seek);
+ return sys_errmsg("cannot seek mtd%d to offset %lld",
+ mtd->mtd_num, (long long)seek);
ret = write(fd, data, len);
if (ret != len)
return sys_errmsg("cannot write %d bytes to mtd%d "