Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/pkg_install/lib select() -> poll()
details: https://anonhg.NetBSD.org/src/rev/796894df185d
branches: trunk
changeset: 536592:796894df185d
user: mycroft <mycroft%NetBSD.org@localhost>
date: Thu Sep 19 02:13:57 2002 +0000
description:
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 d9f121a16824 -r 796894df185d usr.sbin/pkg_install/lib/ftpio.c
--- a/usr.sbin/pkg_install/lib/ftpio.c Thu Sep 19 02:09:52 2002 +0000
+++ b/usr.sbin/pkg_install/lib/ftpio.c Thu Sep 19 02:13:57 2002 +0000
@@ -1,8 +1,8 @@
-/* $NetBSD: ftpio.c,v 1.41 2002/07/20 08:40:19 grant Exp $ */
+/* $NetBSD: ftpio.c,v 1.42 2002/09/19 02:13:57 mycroft Exp $ */
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: ftpio.c,v 1.41 2002/07/20 08:40:19 grant Exp $");
+__RCSID("$NetBSD: ftpio.c,v 1.42 2002/09/19 02:13:57 mycroft 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