Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/linux/arch/i386 Fix previous:



details:   https://anonhg.NetBSD.org/src/rev/4905404ca6e4
branches:  trunk
changeset: 500347:4905404ca6e4
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Dec 10 17:34:25 2000 +0000

description:
Fix previous:
- EBADF, not NULL when a file descriptor can't be found.
- Check FIF_WANTCLOSE properly.

diffstat:

 sys/compat/linux/arch/i386/linux_machdep.c |  12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diffs (26 lines):

diff -r 12f4f60ba1fb -r 4905404ca6e4 sys/compat/linux/arch/i386/linux_machdep.c
--- a/sys/compat/linux/arch/i386/linux_machdep.c        Sun Dec 10 17:03:34 2000 +0000
+++ b/sys/compat/linux/arch/i386/linux_machdep.c        Sun Dec 10 17:34:25 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_machdep.c,v 1.52 2000/12/10 14:09:59 fvdl Exp $  */
+/*     $NetBSD: linux_machdep.c,v 1.53 2000/12/10 17:34:25 thorpej Exp $       */
 
 /*-
  * Copyright (c) 1995, 2000 The NetBSD Foundation, Inc.
@@ -623,12 +623,10 @@
 
        fdp = p->p_fd;
 
-       if (fd < 0 || fd >= fdp->fd_nfiles)
-               return NULL;
-
-       fp = fdp->fd_ofiles[fd];
-       if (fp == NULL)
-               return NULL;
+       if ((u_int)fd >= fdp->fd_nfiles ||
+           (fp = fdp->fd_ofiles[fd]) == NULL ||
+           (fp->f_iflags & FIF_WANTCLOSE) != 0)
+               return (EBADF);
 
        switch (com) {
 #if (NWSDISPLAY > 0)



Home | Main Index | Thread Index | Old Index