Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Fail to open read-write when created read-only.



details:   https://anonhg.NetBSD.org/src/rev/00aa20ebf0a9
branches:  trunk
changeset: 983898:00aa20ebf0a9
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Jun 13 10:01:43 2021 +0000

description:
Fail to open read-write when created read-only.

diffstat:

 sys/dev/vnd.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r a2797a2ea67f -r 00aa20ebf0a9 sys/dev/vnd.c
--- a/sys/dev/vnd.c     Sun Jun 13 09:58:28 2021 +0000
+++ b/sys/dev/vnd.c     Sun Jun 13 10:01:43 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vnd.c,v 1.280 2021/04/11 18:18:39 mlelstv Exp $        */
+/*     $NetBSD: vnd.c,v 1.281 2021/06/13 10:01:43 mlelstv Exp $        */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008, 2020 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.280 2021/04/11 18:18:39 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.281 2021/06/13 10:01:43 mlelstv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -364,6 +364,11 @@
                goto done;
        }
 
+       if ((flags & FWRITE) && (sc->sc_flags & VNF_READONLY)) {
+               error = EROFS;
+               goto done;
+       }
+
        if (sc->sc_flags & VNF_INITED) {
                if ((sc->sc_dkdev.dk_openmask & ~(1<<RAW_PART)) != 0) {
                        /*



Home | Main Index | Thread Index | Old Index