Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Feb 2019 15:33:05 +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-11@freebsd.org
Subject:   svn commit: r344124 - stable/11/usr.sbin/kbdcontrol
Message-ID:  <201902141533.x1EFX5Dx028532@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



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