Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/librumphijack Fix select() if no fds are set.



details:   https://anonhg.NetBSD.org/src/rev/3d186d923769
branches:  trunk
changeset: 761957:3d186d923769
user:      pooka <pooka%NetBSD.org@localhost>
date:      Sat Feb 12 10:25:46 2011 +0000

description:
Fix select() if no fds are set.

patch from Alexander Nasonov, PR lib/44552

diffstat:

 lib/librumphijack/hijack.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (35 lines):

diff -r 5af2cd272170 -r 3d186d923769 lib/librumphijack/hijack.c
--- a/lib/librumphijack/hijack.c        Sat Feb 12 05:15:39 2011 +0000
+++ b/lib/librumphijack/hijack.c        Sat Feb 12 10:25:46 2011 +0000
@@ -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;



Home | Main Index | Thread Index | Old Index