Browse Source

Fix compile-time warnings

Fix all warnings generated by GCC -Wall -Wextra flags.
develop
Damien Goutte-Gattat 7 years ago
parent
commit
4c282b9d81
  1. 5
      src/wait4.c
  2. 5
      src/wait4pid.c

5
src/wait4.c

@ -23,6 +23,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#include <getopt.h>
#include <errno.h>
#include <err.h>
@ -79,7 +80,7 @@ get_integer_or_die(const char *arg)
errno = 0;
val = strtol(arg, &endptr, 10);
if ( errno != 0 || endptr == arg )
errx(EXIT_FAILURE, "invalid argument, integer expected: %s");
errx(EXIT_FAILURE, "invalid argument, integer expected: %s", arg);
return val;
}
@ -87,6 +88,8 @@ get_integer_or_die(const char *arg)
static void
on_alarm(int sig)
{
(void)sig;
exit(EXIT_SUCCESS);
}

5
src/wait4pid.c

@ -147,7 +147,7 @@ wait4pid_init(void)
static int
set_filter(int sock, pid_t *pids, size_t len)
{
int i;
unsigned i;
struct sock_fprog flt;
struct sock_filter filter[256] = {
/* Load event type. */
@ -195,7 +195,7 @@ set_filter(int sock, pid_t *pids, size_t len)
int
wait4all(pid_t *pids, size_t len)
{
int ec, nproc, i;
unsigned ec, nproc, i;
struct cn_proc_msg *payload;
char buf[NLMSG_SPACE(sizeof(struct cn_proc_msg))];
@ -212,6 +212,7 @@ wait4all(pid_t *pids, size_t len)
return -1;
#endif
ec = 0;
nproc = len;
while ( nproc > 0 ) {
if ( do_recv(sock, buf, sizeof(buf), 0) <= 0 )

Loading…
Cancel
Save