From 5d0fb0ef703ca78f399aadce43dd813effda52f5 Mon Sep 17 00:00:00 2001 From: Gerardo Exequiel Pozzi Date: Mon, 9 Mar 2009 13:58:44 -0700 Subject: minilogd: Initialize values for accept() From the accept(2) manpage: The addrlen argument is a value-result argument: the caller must initialize it to contain the size (in bytes) of the structure pointed to by addr; on return it will contain the actual size of the peer address. Signed-off-by: Aaron Griffin --- minilogd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/minilogd.c b/minilogd.c index 743a585..32ca53e 100644 --- a/minilogd.c +++ b/minilogd.c @@ -78,8 +78,8 @@ void cleanup(int exitcode) { void runDaemon(int sock) { struct sockaddr_un addr; int x,len,done=0; - socklen_t addrlen; - char *message; + socklen_t addrlen = sizeof(struct sockaddr_un); + char *message = NULL; struct stat s1,s2; struct pollfd pfds; -- cgit v1.2.3