Source-Changes-HG archive

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

[src/trunk]: src/sys/dev - Return ENOTTY rather than EINVAL for invalid ioctl...



details:   https://anonhg.NetBSD.org/src/rev/1c656f92c184
branches:  trunk
changeset: 819176:1c656f92c184
user:      rin <rin%NetBSD.org@localhost>
date:      Mon Nov 21 03:53:59 2016 +0000

description:
- Return ENOTTY rather than EINVAL for invalid ioctl, suggested by
  mlelstv.
- Protect NTP stuff in COMPAT_50 codes by NTP macro.

Approved by mlelstv

diffstat:

 sys/dev/clockctl.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (46 lines):

diff -r 9bef0ff1aae1 -r 1c656f92c184 sys/dev/clockctl.c
--- a/sys/dev/clockctl.c        Mon Nov 21 03:50:50 2016 +0000
+++ b/sys/dev/clockctl.c        Mon Nov 21 03:53:59 2016 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: clockctl.c,v 1.34 2016/01/06 18:06:38 christos Exp $ */
+/*      $NetBSD: clockctl.c,v 1.35 2016/11/21 03:53:59 rin Exp $ */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clockctl.c,v 1.34 2016/01/06 18:06:38 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clockctl.c,v 1.35 2016/11/21 03:53:59 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ntp.h"
@@ -266,7 +266,7 @@
 #ifdef COMPAT_50
                error = compat50_clockctlioctl(dev, cmd, data, flags, l);
 #else
-               error = EINVAL;
+               error = ENOTTY;
 #endif
        }
 
@@ -328,13 +328,16 @@
                error = clock_settime1(l->l_proc, args->clock_id, &tp, true);
                break;
        }
-       case CLOCKCTL_ONTP_ADJTIME:
+#ifdef NTP
+       case CLOCKCTL_ONTP_ADJTIME: {
                /* The ioctl number changed but the data did not change. */
                error = (cd->d_ioctl)(dev, CLOCKCTL_NTP_ADJTIME,
                    data, flags, l);
                break;
+       }
+#endif
        default:
-               error = EINVAL;
+               error = ENOTTY;
        }
 
        return (error);



Home | Main Index | Thread Index | Old Index