Commit 1b6c0163 authored by J.H.M. Dassen's avatar J.H.M. Dassen Committed by Niels Möller
Browse files

More portable initialization of sigaction structures.

(jdassen@wi.leidenuniv.nl)

Rev: src/io.c:1.34
Rev: src/reaper.c:1.6
parent 7b0d1ee7
......@@ -123,7 +123,7 @@ int io_iter(struct io_backend *b)
/* Fill out fds-array */
{
struct lsh_fd *fd;
int i;
unsigned long i;
int all_events = 0;
for (fd = b->files, i = 0; fd; fd = fd->next, i++)
......@@ -179,7 +179,7 @@ int io_iter(struct io_backend *b)
* head of the list, or set the close_now flag on any fd. */
struct lsh_fd *fd;
int i;
unsigned long i;
for(fd = b->files, i=0; fd; fd = fd->next, i++)
{
......@@ -393,11 +393,11 @@ static void connect_callback(struct lsh_fd *fd)
void io_run(struct io_backend *b)
{
struct sigaction pipe;
memset(&pipe, 0, sizeof(pipe));
pipe.sa_handler = SIG_IGN;
sigemptyset(&pipe.sa_mask);
pipe.sa_flags = 0;
pipe.sa_restorer = NULL;
if (sigaction(SIGPIPE, &pipe, NULL) < 0)
fatal("Failed to ignore SIGPIPE.\n");
......@@ -473,7 +473,7 @@ get_inaddr(struct sockaddr_in * addr,
hp = gethostbyname(host);
if (hp == NULL)
return 0;
memcpy(&addr->sin_addr, hp->h_addr, hp->h_length);
memcpy(&addr->sin_addr, hp->h_addr, (size_t) (hp->h_length));
addr->sin_family = hp->h_addrtype;
}
}
......
......@@ -159,15 +159,16 @@ void reaper_run(struct reap *r, struct io_backend *b)
struct sigaction pipe;
struct sigaction chld;
memset(&pipe, 0, sizeof(pipe));
memset(&chld, 0, sizeof(chld));
pipe.sa_handler = SIG_IGN;
sigemptyset(&pipe.sa_mask);
pipe.sa_flags = 0;
pipe.sa_restorer = NULL;
chld.sa_handler = child_handler;
sigemptyset(&chld.sa_mask);
chld.sa_flags = SA_NOCLDSTOP;
chld.sa_restorer = NULL;
if (sigaction(SIGPIPE, &pipe, NULL) < 0)
fatal("Failed to ignore SIGPIPE.\n");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment