Source-Changes-HG archive

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

[src/trunk]: src/sys/kern sem_open and friends should return EINVAL if the se...



details:   https://anonhg.NetBSD.org/src/rev/fa08ba461fc8
branches:  trunk
changeset: 777927:fa08ba461fc8
user:      joerg <joerg%NetBSD.org@localhost>
date:      Fri Mar 09 21:03:46 2012 +0000

description:
sem_open and friends should return EINVAL if the semaphore is not valid.

diffstat:

 sys/kern/uipc_sem.c |  11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diffs (34 lines):

diff -r bf684b4f11be -r fa08ba461fc8 sys/kern/uipc_sem.c
--- a/sys/kern/uipc_sem.c       Fri Mar 09 21:03:09 2012 +0000
+++ b/sys/kern/uipc_sem.c       Fri Mar 09 21:03:46 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_sem.c,v 1.36 2012/03/08 21:59:30 joerg Exp $      */
+/*     $NetBSD: uipc_sem.c,v 1.37 2012/03/09 21:03:46 joerg Exp $      */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v 1.36 2012/03/08 21:59:30 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v 1.37 2012/03/09 21:03:46 joerg Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -241,12 +241,11 @@
        file_t *fp;
 
        fp = fd_getfile(fd);
-       if (__predict_false(fp == NULL)) {
-               return EBADF;
-       }
+       if (__predict_false(fp == NULL))
+               return EINVAL;
        if (__predict_false(fp->f_type != DTYPE_SEM)) {
                fd_putfile(fd);
-               return EBADF;
+               return EINVAL;
        }
        ks = fp->f_data;
        mutex_enter(&ks->ks_lock);



Home | Main Index | Thread Index | Old Index