Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/wsfont wsfont(4): WSDISPLAYIO_LDFONT requires device...



details:   https://anonhg.NetBSD.org/src/rev/21118befd78e
branches:  trunk
changeset: 366063:21118befd78e
user:      uwe <uwe%NetBSD.org@localhost>
date:      Thu May 12 23:17:42 2022 +0000

description:
wsfont(4): WSDISPLAYIO_LDFONT requires device opened for writing.

diffstat:

 sys/dev/wsfont/wsfontdev.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (33 lines):

diff -r 3b15dea05dd7 -r 21118befd78e sys/dev/wsfont/wsfontdev.c
--- a/sys/dev/wsfont/wsfontdev.c        Thu May 12 22:25:38 2022 +0000
+++ b/sys/dev/wsfont/wsfontdev.c        Thu May 12 23:17:42 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsfontdev.c,v 1.19 2021/04/24 00:15:37 macallan Exp $ */
+/* $NetBSD: wsfontdev.c,v 1.20 2022/05/12 23:17:42 uwe Exp $ */
 
 /*
  * Copyright (c) 2001
@@ -27,11 +27,12 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsfontdev.c,v 1.19 2021/04/24 00:15:37 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsfontdev.c,v 1.20 2022/05/12 23:17:42 uwe Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/conf.h>
+#include <sys/fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/malloc.h>
 #include <sys/event.h>
@@ -122,6 +123,9 @@
        switch (cmd) {
        case WSDISPLAYIO_LDFONT:
 #define d ((struct wsdisplay_font *)data)
+               if ((flag & FWRITE) == 0)
+                       return EPERM;
+
                if (d->name) {
                        res = copyinstr(d->name, nbuf, sizeof(nbuf), 0);
                        if (res)



Home | Main Index | Thread Index | Old Index