Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Feb 2019 14:13:49 +0000 (UTC)
From:      Stefan Esser <se@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r343937 - stable/12/usr.sbin/kbdcontrol
Message-ID:  <201902091413.x19EDnIb069167@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: se
Date: Sat Feb  9 14:13:49 2019
New Revision: 343937
URL: https://svnweb.freebsd.org/changeset/base/343937

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 is replaced by "\e".

Modified:
  stable/12/usr.sbin/kbdcontrol/kbdcontrol.c

Modified: stable/12/usr.sbin/kbdcontrol/kbdcontrol.c
==============================================================================
--- stable/12/usr.sbin/kbdcontrol/kbdcontrol.c	Sat Feb  9 14:07:04 2019	(r343936)
+++ stable/12/usr.sbin/kbdcontrol/kbdcontrol.c	Sat Feb  9 14:13:49 2019	(r343937)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201902091413.x19EDnIb069167>