Source-Changes-HG archive

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

[src/trunk]: src/sbin/mount_portal prevent hang on vnode EOF.



details:   https://anonhg.NetBSD.org/src/rev/d867e348dc3c
branches:  trunk
changeset: 823795:d867e348dc3c
user:      christos <christos%NetBSD.org@localhost>
date:      Tue May 09 21:17:54 2017 +0000

description:
prevent hang on vnode EOF.

diffstat:

 sbin/mount_portal/puffs_portal.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r 432c4f295b04 -r d867e348dc3c sbin/mount_portal/puffs_portal.c
--- a/sbin/mount_portal/puffs_portal.c  Tue May 09 21:15:30 2017 +0000
+++ b/sbin/mount_portal/puffs_portal.c  Tue May 09 21:17:54 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: puffs_portal.c,v 1.7 2012/11/04 22:30:23 christos Exp $        */
+/*     $NetBSD: puffs_portal.c,v 1.8 2017/05/09 21:17:54 christos Exp $        */
 
 /*
  * Copyright (c) 2007  Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: puffs_portal.c,v 1.7 2012/11/04 22:30:23 christos Exp $");
+__RCSID("$NetBSD: puffs_portal.c,v 1.8 2017/05/09 21:17:54 christos Exp $");
 #endif /* !lint */
 
 #include <sys/types.h>
@@ -180,6 +180,13 @@
        do {
                n = read(fd, buf, MIN(sizeof(buf), max));
                if (n == 0) {
+                       /*
+                        * Deal with EOF here by closing the file descriptor
+                        * and thus causing an error on subsequent accesses.
+                        * This is the last kevent notification we are going
+                        * to be getting for regular files.
+                        */
+                       close(fd);
                        if (moved)
                                break;
                        else



Home | Main Index | Thread Index | Old Index