]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
misc: fix some warnings
authorRuediger Meier <ruediger.meier@ga-group.nl>
Wed, 31 May 2017 21:58:11 +0000 (23:58 +0200)
committerRuediger Meier <ruediger.meier@ga-group.nl>
Thu, 1 Jun 2017 08:28:18 +0000 (10:28 +0200)
sys-utils/prlimit.c: In function 'do_prlimit':
sys-utils/prlimit.c:367:16: warning: format '%ju' expects argument of type 'uintmax_t', but argument 2 has type 'rlim_t {aka long long unsigned int}' [-Wformat=]
     printf("<%ju", new->rlim_cur);

lib/plymouth-ctrl.c: In function 'open_un_socket_and_connect':
lib/plymouth-ctrl.c:88:20: warning: passing argument 2 of 'connect' from incompatible pointer type [-Wincompatible-pointer-types]
  ret = connect(fd, &su, offsetof(struct sockaddr_un, sun_path) + 1 + strlen(su.sun_path+1));
                    ^
In file included from lib/plymouth-ctrl.c:35:0:
/usr/include/sys/socket.h:314:5: note: expected 'const struct sockaddr *' but argument is of type 'struct sockaddr_un *'
 int connect (int, const struct sockaddr *, socklen_t);

login-utils/last.c: In function 'list':
login-utils/last.c:506:54: warning: pointer targets in passing argument 4 of 'dns_lookup' differ in signedness [-Wpointer-sign]
   r = dns_lookup(domain, sizeof(domain), ctl->useip, p->ut_addr_v6);
                                                      ^
login-utils/last.c:291:12: note: expected 'int32_t * {aka int *}' but argument is of type 'unsigned int *'
 static int dns_lookup(char *result, int size, int useip, int32_t *a)
            ^~~~~~~~~~

In file included from sys-utils/hwclock-cmos.c:92:0:
sys-utils/hwclock.h:67:32: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
 extern double time_diff(struct timeval subtrahend, struct timeval subtractor);

misc-utils/test_uuidd.c: In function 'create_nthreads':
misc-utils/test_uuidd.c:187:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
        proc->pid, (int) th->tid, th->index));

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
lib/plymouth-ctrl.c
login-utils/last.c
misc-utils/test_uuidd.c
sys-utils/hwclock.h
sys-utils/prlimit.c

index 75d8b93429931231728af3cbf59dcadff1b3009d..0e60341a137026d897d1486667c0735daf15ff73 100644 (file)
@@ -85,7 +85,8 @@ static int open_un_socket_and_connect(void)
         * Please note that the PLYMOUTH_SOCKET_PATH has a
         * leading NULL byte to mark it as an abstract socket
         */
-       ret = connect(fd, &su, offsetof(struct sockaddr_un, sun_path) + 1 + strlen(su.sun_path+1));
+       ret = connect(fd, (const struct sockaddr *) &su,
+                     offsetof(struct sockaddr_un, sun_path) + 1 + strlen(su.sun_path+1));
        if (ret < 0) {
                if (errno != ECONNREFUSED)
                        warnx(_("cannot connect on UNIX socket"));
index 679ea6c123325ab0c0b63a3f69b36d4f36553f07..f93ec7fbfcfe5561170b15357f3abec63924caf1 100644 (file)
@@ -503,7 +503,7 @@ static int list(const struct last_control *ctl, struct utmpx *p, time_t logout_t
         */
        r = -1;
        if (ctl->usedns || ctl->useip)
-               r = dns_lookup(domain, sizeof(domain), ctl->useip, p->ut_addr_v6);
+               r = dns_lookup(domain, sizeof(domain), ctl->useip, (int32_t*)p->ut_addr_v6);
        if (r < 0) {
                size_t sz = sizeof(p->ut_host);
 
index 73cc90a1723ba56f607d7dd5f84bcfedc279fd3d..9883cbf29a4faf1b6a43df9b3dd370bb6f364a32 100644 (file)
@@ -183,8 +183,8 @@ static void create_nthreads(process_t *proc, size_t index)
                        break;
                }
 
-               LOG(2, (stderr, "%d: started thread [tid=%d,index=%zu]\n",
-                    proc->pid, (int) th->tid, th->index));
+               LOG(2, (stderr, "%d: started thread [tid=%jd,index=%zu]\n",
+                    proc->pid, (intmax_t) th->tid, th->index));
                index += nobjects;
                ncreated++;
        }
@@ -203,8 +203,8 @@ static void create_nthreads(process_t *proc, size_t index)
                        err(EXIT_FAILURE, "pthread_join failed");
                }
 
-               LOG(2, (stderr, "%d: thread exited [tid=%d,return=%d]\n",
-                    proc->pid, (int) th->tid, th->retval));
+               LOG(2, (stderr, "%d: thread exited [tid=%jd,return=%d]\n",
+                    proc->pid, (intmax_t) th->tid, th->retval));
        }
 }
 
@@ -256,7 +256,7 @@ static void object_dump(size_t idx, object_t *obj)
        fprintf(stderr, "  uuid:    <%s>\n", p);
        fprintf(stderr, "  idx:     %zu\n", obj->idx);
        fprintf(stderr, "  process: %d\n", (int) obj->pid);
-       fprintf(stderr, "  thread:  %d\n", (int) obj->tid);
+       fprintf(stderr, "  thread:  %jd\n", (intmax_t) obj->tid);
        fprintf(stderr, "}\n");
 }
 
index 7d2cc45acc70efac46009198b5c9795242930d75..f3f76a6dac7f7ab43a0e3ef0f7d943d9f5f05a16 100644 (file)
@@ -5,6 +5,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sys/time.h>
 #include <time.h>
 
 #include "c.h"
index a62d457feb8875ca6ff2f0d31d89c6a5ca0baaaa..afd19281b73e9857747658ad96dae9833c4676cf 100644 (file)
@@ -364,12 +364,12 @@ static void do_prlimit(struct list_head *lims)
                        if (new->rlim_cur == RLIM_INFINITY)
                                printf("<%s", _("unlimited"));
                        else
-                               printf("<%ju", new->rlim_cur);
+                               printf("<%ju", (uintmax_t)new->rlim_cur);
 
                        if (new->rlim_max == RLIM_INFINITY)
                                printf(":%s>\n", _("unlimited"));
                        else
-                               printf(":%ju>\n", new->rlim_max);
+                               printf(":%ju>\n", (uintmax_t)new->rlim_max);
                }
 
                if (prlimit(pid, lim->desc->resource, new, old) == -1)