Module Name:    src
Committed By:   pooka
Date:           Sat Feb 12 10:25:46 UTC 2011

Modified Files:
        src/lib/librumphijack: hijack.c

Log Message:
Fix select() if no fds are set.

patch from Alexander Nasonov, PR lib/44552


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/lib/librumphijack/hijack.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/librumphijack/hijack.c
diff -u src/lib/librumphijack/hijack.c:1.37 src/lib/librumphijack/hijack.c:1.38
--- src/lib/librumphijack/hijack.c:1.37	Fri Feb 11 14:02:12 2011
+++ src/lib/librumphijack/hijack.c	Sat Feb 12 10:25:46 2011
@@ -1,4 +1,4 @@
-/*      $NetBSD: hijack.c,v 1.37 2011/02/11 14:02:12 pooka Exp $	*/
+/*      $NetBSD: hijack.c,v 1.38 2011/02/12 10:25:46 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: hijack.c,v 1.37 2011/02/11 14:02:12 pooka Exp $");
+__RCSID("$NetBSD: hijack.c,v 1.38 2011/02/12 10:25:46 pooka Exp $");
 
 #define __ssp_weak_name(fun) _hijack_ ## fun
 
@@ -563,7 +563,7 @@
 	}
 
 	if (realnfds) {
-		pfds = malloc(sizeof(*pfds) * realnfds);
+		pfds = calloc(realnfds, sizeof(*pfds));
 		if (!pfds)
 			return -1;
 	} else {
@@ -572,7 +572,6 @@
 
 	for (i = 0, j = 0; i < nfds; i++) {
 		incr = 0;
-		pfds[j].events = pfds[j].revents = 0;
 		if (readfds && FD_ISSET(i, readfds)) {
 			pfds[j].fd = i;
 			pfds[j].events |= POLLIN;

Reply via email to