Source-Changes-HG archive

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

[src/netbsd-1-6]: src/usr.sbin/pkg_install/lib Pull up revision 1.42 (request...



details:   https://anonhg.NetBSD.org/src/rev/f0f5e562b4ea
branches:  netbsd-1-6
changeset: 529509:f0f5e562b4ea
user:      tron <tron%NetBSD.org@localhost>
date:      Sun Nov 24 22:29:58 2002 +0000

description:
Pull up revision 1.42 (requested by jschauma in ticket #1011):
select() -> poll()
Also, remove a call to path_create() that causes the `prepend' path held by
pkg_perform() to be deleted, causing a core dump later when pkg_perform()
tries to remove it itself.

diffstat:

 usr.sbin/pkg_install/lib/ftpio.c |  27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)

diffs (83 lines):

diff -r 8a762714d375 -r f0f5e562b4ea usr.sbin/pkg_install/lib/ftpio.c
--- a/usr.sbin/pkg_install/lib/ftpio.c  Sun Nov 24 22:23:49 2002 +0000
+++ b/usr.sbin/pkg_install/lib/ftpio.c  Sun Nov 24 22:29:58 2002 +0000
@@ -1,8 +1,8 @@
-/*     $NetBSD: ftpio.c,v 1.35.2.4 2002/07/23 11:06:20 lukem Exp $     */
+/*     $NetBSD: ftpio.c,v 1.35.2.5 2002/11/24 22:29:58 tron Exp $      */
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ftpio.c,v 1.35.2.4 2002/07/23 11:06:20 lukem Exp $");
+__RCSID("$NetBSD: ftpio.c,v 1.35.2.5 2002/11/24 22:29:58 tron Exp $");
 #endif
 
 /*
@@ -37,6 +37,7 @@
 
 #include <sys/types.h>
 #include <sys/time.h>
+#include <sys/poll.h>
 #include <signal.h>
 #include <assert.h>
 #include <ctype.h>
@@ -100,7 +101,7 @@
 #endif /* EXPECT_DEBUG */
     regex_t rstr;
     int done;
-    struct timeval timeout;
+    struct pollfd set[1];
     int retval;
     regmatch_t match;
     int verbose_expect=0;
@@ -124,16 +125,12 @@
 
     memset(buf, '\n', sizeof(buf));
 
-    timeout.tv_sec=10*60;    /* seconds until next message from tar */
-    timeout.tv_usec=0;
     done=0;
     retval=0;
+    set[0].fd = fd;
+    set[0].events = POLLIN;
     while(!done) {
-       fd_set fdset;
-
-       FD_ZERO(&fdset);
-       FD_SET(fd, &fdset);
-       rc = select(FD_SETSIZE, &fdset, NULL, NULL, &timeout);
+       rc = poll(set, 1, 10*60*1000);    /* seconds until next message from tar */
        switch (rc) {
        case -1:
            if (errno == EINTR)
@@ -164,6 +161,12 @@
            retval = -1;
            break;
        default:
+           if (set[0].revents & POLLHUP) {
+               done = 1;
+               retval = -1;
+               break;
+           }
+
            rc=read(fd,&buf[sizeof(buf)-1],1);
 
            if (verbose_expect)
@@ -332,7 +335,7 @@
 static void
 sigchld_handler (int n)
 {
-       /* Make select(2) return EINTR */
+       /* Make poll(2) return EINTR */
 }
 
 
@@ -667,7 +670,9 @@
        /* Leave a hint for any depending pkgs that may need it */
        if (getenv("PKG_PATH") == NULL) {
                setenv("PKG_PATH", pkg_path, 1);
+#if 0
                path_create(pkg_path); /* XXX */
+#endif
                printf("setenv PKG_PATH='%s'\n",pkg_path);
        }
        



Home | Main Index | Thread Index | Old Index