I'm getting the following compiler warnings on Cygwin with gcc-5.4.0:
system.c:122:30: warning: unused variable ‘auth_data’ [-Wunused-variable]
const struct mu_auth_data *auth_data = key;
copyfile.c:166:16: warning: cast from pointer to integer of different
size [-Wpointer-to-int-cast]
if (fchmod ((int) trans[0], mode))
^
copyfile.c:196:17: warning: cast from pointer to integer of different
size [-Wpointer-to-int-cast]
if (fchown ((int) trans[0], uid, gid))
^
The attached patch silences the warnings. I'm not sure whether the
patch to copyfile.c is correct; it seems strange to be casting a pointer
to an integer which is then used as a file descriptor. But I admit that
I haven't studied the code.
Ken
From f5bdee69facb521421e6e5dd198d3061cd716951 Mon Sep 17 00:00:00 2001
From: Ken Brown <[email protected]>
Date: Thu, 27 Apr 2017 13:42:30 -0400
Subject: [PATCH] Avoid compiler warnings
* libmailutils/auth/system.c (mu_authenticate_system): Only
declare auth_data if HAVE_SHADOW_H is defined.
* libmailutils/base/copyfile.c (copy_regular_file): Cast trans[0]
to intptr_t instead of int.
---
libmailutils/auth/system.c | 2 +-
libmailutils/base/copyfile.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/libmailutils/auth/system.c b/libmailutils/auth/system.c
index d6a8db065..6a7fdb236 100644
--- a/libmailutils/auth/system.c
+++ b/libmailutils/auth/system.c
@@ -119,9 +119,9 @@ mu_authenticate_system (struct mu_auth_data **return_data
MU_ARG_UNUSED,
void *func_data MU_ARG_UNUSED,
void *call_data)
{
+#ifdef HAVE_SHADOW_H
const struct mu_auth_data *auth_data = key;
-#ifdef HAVE_SHADOW_H
char *pass = call_data;
if (auth_data)
diff --git a/libmailutils/base/copyfile.c b/libmailutils/base/copyfile.c
index 9a72228ce..dd9dbac7e 100644
--- a/libmailutils/base/copyfile.c
+++ b/libmailutils/base/copyfile.c
@@ -163,7 +163,7 @@ copy_regular_file (const char *srcpath, const char
*dstpath, int flags,
rc = mu_stream_ioctl (dst, MU_IOCTL_TRANSPORT, MU_IOCTL_OP_GET, trans);
if (rc == 0)
{
- if (fchmod ((int) trans[0], mode))
+ if (fchmod ((intptr_t) trans[0], mode))
{
mu_debug (MU_DEBCAT_STREAM, MU_DEBUG_ERROR,
(_("%s: cannot chmod: %s"),
@@ -193,7 +193,7 @@ copy_regular_file (const char *srcpath, const char
*dstpath, int flags,
if (gid != -1)
{
- if (fchown ((int) trans[0], uid, gid))
+ if (fchown ((intptr_t) trans[0], uid, gid))
{
mu_debug (MU_DEBCAT_STREAM, MU_DEBUG_ERROR,
(_("%s: cannot chown to %lu.%lu: %s"),
--
2.12.2
_______________________________________________
Bug-mailutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-mailutils