]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] ENOTTY for rtc ioctl
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 22 Apr 2002 06:10:38 +0000 (23:10 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Mon, 22 Apr 2002 06:10:38 +0000 (23:10 -0700)
Paul Gortmaker <p_gortmaker@yahoo.com>: ENOTTY for rtc ioctl:
   ioctl(d, valid, crap) --> -EINVAL
   ioctl(d, crap, ....)  --> -ENOTTY

  man ioctl agrees:

         ENOTTY The specified request does not apply to the kind of
                object that the descriptor d references.

  Currently we return -EINVAL for both cases which is not as
  informative for debugging stuff.

  Patch is for 2.5.6 but applies cleanly (with minor offset) to 2.4.19p2

  Paul.

(Included in 2.2)
(Included in 2.4)

drivers/char/rtc.c

index 2ebca07cf1d791500ad8a4784e5a0b82c3fd569d..006e0c3d2c3dc166ac68531cf2a7810a6de44aaa 100644 (file)
@@ -544,7 +544,7 @@ static int rtc_do_ioctl(unsigned int cmd, unsigned long arg, int kernel)
                return 0;
        }
        default:
-               return -EINVAL;
+               return -ENOTTY;
        }
        return copy_to_user((void *)arg, &wtime, sizeof wtime) ? -EFAULT : 0;
 }