dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone
Blob Blame History Raw
From 191f3722f28107ccde4ce96dd88a401fb36b059a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
Date: Mon, 10 Feb 2020 11:52:35 +0100
Subject: [PATCH] sss_sockets: pass pointer instead of integer
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

```
/home/pbrezina/workspace/sssd/src/util/sss_sockets.c: In function ‘set_fd_common_opts’:
/home/pbrezina/workspace/sssd/src/util/sss_sockets.c:123:61: error: passing argument 4 of ‘setsockopt’ makes pointer from integer without a cast [-Werror=int-conversion]
  123 |         ret = setsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT, milli,
      |                                                             ^~~~~
      |                                                             |
      |                                                             unsigned int
In file included from /home/pbrezina/workspace/sssd/src/util/sss_sockets.c:28:
/usr/include/sys/socket.h:216:22: note: expected ‘const void *’ but argument is of type ‘unsigned int’
  216 |          const void *__optval, socklen_t __optlen) __THROW;
      |          ~~~~~~~~~~~~^~~~~~~~
  CC       src/util/sssd_kcm-sss_iobuf.o
cc1: all warnings being treated as errors
```

Introduced by 7aa96458f3bec4ef6ff7385107458e6b2b0b06ac

Reviewed-by: Sumit Bose <sbose@redhat.com>
(cherry picked from commit 5b87af6f5b50c464ee7ea4558f73431e398e1423)
---
 src/util/sss_sockets.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/sss_sockets.c b/src/util/sss_sockets.c
index b6b6dbac5..6f2b71bc8 100644
--- a/src/util/sss_sockets.c
+++ b/src/util/sss_sockets.c
@@ -120,7 +120,7 @@ static errno_t set_fd_common_opts(int fd, int timeout)
         }
 
         milli = timeout * 1000; /* timeout in milliseconds */
-        ret = setsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT, milli,
+        ret = setsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT, &milli,
                          sizeof(milli));
         if (ret != 0) {
             ret = errno;
-- 
2.20.1