Author: hselasky
Date: Sun May 10 17:11:04 2015
New Revision: 282730
URL: https://svnweb.freebsd.org/changeset/base/282730

Log:
  Ensure the result from signed subtraction under modulus does not
  become negative.
  
  Submitted by:         Oliver Pinter <[email protected]>
  MFC after:            3 days

Modified:
  head/sys/dev/vt/vt_core.c

Modified: head/sys/dev/vt/vt_core.c
==============================================================================
--- head/sys/dev/vt/vt_core.c   Sun May 10 14:50:50 2015        (r282729)
+++ head/sys/dev/vt/vt_core.c   Sun May 10 17:11:04 2015        (r282730)
@@ -785,7 +785,7 @@ vt_processkey(keyboard_t *kbd, struct vt
                        return (0);
                case PREV:
                        /* Switch to previous VT. */
-                       c = (vw->vw_number - 1) % VT_MAXWINDOWS;
+                       c = (vw->vw_number + VT_MAXWINDOWS - 1) % VT_MAXWINDOWS;
                        vw = vd->vd_windows[c];
                        vt_proc_window_switch(vw);
                        return (0);
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to