Author: se
Date: Thu Feb 14 15:33:04 2019
New Revision: 344124
URL: https://svnweb.freebsd.org/changeset/base/344124

Log:
  MFC r343339: Silence Clang Scan warning about use of unitialized variable.
  
  The logic is changed to depend on actual "beep" parameters instead of on a
  flag that may be set for invalid parameters.
  
  An embedded literal escape character has been replaced by "\e", since it
  could confuse terminals when displaying the affected line.

Modified:
  stable/11/usr.sbin/kbdcontrol/kbdcontrol.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/kbdcontrol/kbdcontrol.c
==============================================================================
--- stable/11/usr.sbin/kbdcontrol/kbdcontrol.c  Thu Feb 14 15:15:32 2019        
(r344123)
+++ stable/11/usr.sbin/kbdcontrol/kbdcontrol.c  Thu Feb 14 15:33:04 2019        
(r344124)
@@ -961,6 +961,8 @@ set_bell_values(char *opt)
        int bell, duration, pitch;
 
        bell = 0;
+       duration = 0;
+       pitch = 0;
        if (!strncmp(opt, "quiet.", 6)) {
                bell = CONS_QUIET_BELL;
                opt += 6;
@@ -991,8 +993,8 @@ badopt:
        }
 
        ioctl(0, CONS_BELLTYPE, &bell);
-       if (!(bell & CONS_VISUAL_BELL))
-               fprintf(stderr, "[=%d;%dB", pitch, duration);
+       if (duration > 0 && pitch > 0)
+               fprintf(stderr, "\e[=%d;%dB", pitch, duration);
 }
 
 static void
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to