diff --git a/ChangeLog b/ChangeLog
index 9efe003..3838b7e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
ChangeLog for davfs2
--------------------
---------------------
+
+2012-08-03 Werner Baumann (werner.baumann@onlinehome.de)
+ * cache.c, kernel_interface.c:
+ Fix integer format warnings.
2012-06-03 Werner Baumann (werner.baumann@onlinehome.de)
* cache.c, has_permission:
diff --git a/src/Makefile.am b/src/Makefile.am
index 331723e..34313e4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -33,7 +33,8 @@ mount_davfs_SOURCES = cache.c dav_coda.c \
umount_davfs_SOURCES = umount_davfs.c defaults.h
AM_CPPFLAGS = -I$(top_builddir)/gl -I$(top_srcdir)/gl
-AM_CFLAGS = -Wall
+AM_CFLAGS = -Wall -Werror=format-security \
+ -fstack-protector --param=ssp-buffer-size=4
DEFS = -DPROGRAM_NAME=\"mount.davfs\" \
-DDAV_SYS_CONF_DIR=\"$(pkgsysconfdir)\" \
-DDAV_SYS_RUN=\"$(pkglocalstatedir)\" \
@@ -45,7 +46,8 @@ DEFS = -DPROGRAM_NAME=\"mount.davfs\" \
-DDAV_DATA_DIR=\"$(pkgdatadir)\" \
-DLOCALEDIR=\"$(localedir)\" \
-DDAV_USER=\"$(dav_user)\" \
- -DDAV_GROUP=\"$(dav_group)\" @DEFS@
+ -DDAV_GROUP=\"$(dav_group)\" \
+ -D_FORTIFY_SOURCE=2 @DEFS@
LIBS = $(NEON_LIBS) @LIBS@
mount_davfs_LDADD = $(LIBINTL) $(LIBICONV) ../gl/libgnu.a
umount_davfs_LDADD = $(LIBINTL) ../gl/libgnu.a
diff --git a/src/cache.c b/src/cache.c
index b0b0748..90f7271 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -592,7 +592,7 @@ dav_init_cache(const dav_args *args, const char *mpoint)
alignment = test_alignment();
if (debug)
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Alignment of dav_node: %i",
- alignment);
+ (int) alignment);
default_uid = args->fsuid;
default_gid = args->fsgid;
@@ -746,9 +746,10 @@ dav_tidy_cache(void)
{
if (debug) {
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG),
- "tidy: %i of %llu nodes changed", nchanged, fs_stat->files);
+ "tidy: %i of %lli nodes changed", nchanged,
+ (long long int) fs_stat->files);
syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "cache-size: %llu MiBytes.",
- (cache_size + 0x80000) / 0x100000);
+ (unsigned long long int) (cache_size + 0x80000) / 0x100000);
}
if (cache_size > max_cache_size)
@@ -1216,7 +1217,8 @@ dav_read(ssize_t *len, dav_node * node, int fd, char *buf, size_t size,
*len = pread(fd, buf, size, offset);
if (debug)
- syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "read %i", *len);
+ syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "read %lli",
+ (long long int) *len);
if (*len < 0)
return errno;
@@ -1609,7 +1611,8 @@ dav_write(size_t *written, dav_node * node, int fd, char *buf, size_t size,
}
if (debug)
- syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " written %i", *written);
+ syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " written %llui",
+ (unsinged long long int) *written);
return 0;
}
@@ -3059,13 +3062,8 @@ write_node(dav_node *node, FILE *file, const char *indent)
}
if (is_reg(node)) {
-#if _FILE_OFFSET_BITS == 64
- if (fprintf(file, "%s%lli\n", ind, type[SIZE], node->size,
- type[SIZE]) < 0)
-#else
- if (fprintf(file, "%s%li\n", ind, type[SIZE], node->size,
- type[SIZE]) < 0)
-#endif
+ if (fprintf(file, "%s%lli\n", ind, type[SIZE],
+ (long long int) node->size, type[SIZE]) < 0)
return -1;
}
diff --git a/src/kernel_interface.c b/src/kernel_interface.c
index a135d59..2ed5731 100644
--- a/src/kernel_interface.c
+++ b/src/kernel_interface.c
@@ -243,11 +243,11 @@ init_fuse(int *dev, dav_run_msgloop_fn *msg_loop, void **mdata,
#if SIZEOF_VOID_P == 8
*mdata = xasprintf("fd=%i,rootmode=%o,user_id=%i,group_id=%i,"
"allow_other,max_read=%lu", *dev, mode, owner, group,
- *buf_size - 4096);
+ (unsigned long int) (*buf_size - 4096));
#else
*mdata = xasprintf("fd=%i,rootmode=%o,user_id=%i,group_id=%i,"
"allow_other,max_read=%u", *dev, mode, owner, group,
- *buf_size - 4096);
+ (unsigned int) (*buf_size - 4096));
#endif
if (mount(url, mpoint, "fuse", mopts, *mdata) == 0) {
*msg_loop = dav_fuse_loop;