summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorpooka <pooka@NetBSD.org>2008-12-12 19:56:12 +0000
committerpooka <pooka@NetBSD.org>2008-12-12 19:56:12 +0000
commita75f7c734310d8acb1ffce691dcc06fef19ebaaa (patch)
treeb6770500ca17ada802239f035a4b4df221b56584 /lib
parent710e4c1a30d2559f6d7a00379d54bfc30922f5de (diff)
Close write-end of daemonpipe in reader to get EOF if the writer
goes awol.
Diffstat (limited to 'lib')
-rw-r--r--lib/libpuffs/puffs.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libpuffs/puffs.c b/lib/libpuffs/puffs.c
index c066af24f34..b11cbe037db 100644
--- a/lib/libpuffs/puffs.c
+++ b/lib/libpuffs/puffs.c
@@ -1,4 +1,4 @@
-/* $NetBSD: puffs.c,v 1.94 2008/12/12 19:45:16 pooka Exp $ */
+/* $NetBSD: puffs.c,v 1.95 2008/12/12 19:56:12 pooka Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
-__RCSID("$NetBSD: puffs.c,v 1.94 2008/12/12 19:45:16 pooka Exp $");
+__RCSID("$NetBSD: puffs.c,v 1.95 2008/12/12 19:56:12 pooka Exp $");
#endif /* !lint */
#include <sys/param.h>
@@ -428,10 +428,12 @@ puffs_daemon(struct puffs_usermount *pu, int nochdir, int noclose)
pu->pu_state |= PU_PUFFSDAEMON;
if (parent) {
+ close(pu->pu_dpipe[1]);
n = read(pu->pu_dpipe[0], &value, sizeof(int));
if (n == -1)
err(1, "puffs_daemon");
- assert(n == sizeof(value));
+ if (n != sizeof(value))
+ errx(1, "puffs_daemon got %d bytes", n);
if (value) {
errno = value;
err(1, "puffs_daemon");