Exit beep when error accessing API
This commit is contained in:
parent
f52e0c5d04
commit
83ca10bffe
2 changed files with 45 additions and 0 deletions
39
0015-If-do_beep-sees-error-from-API-exit-program.patch
Normal file
39
0015-If-do_beep-sees-error-from-API-exit-program.patch
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
From d419a0daa59a3afbbc14354feed2701ed2109afb Mon Sep 17 00:00:00 2001
|
||||
From: Hans Ulrich Niedermann <hun@n-dimensional.de>
|
||||
Date: Fri, 28 Dec 2018 06:01:10 +0100
|
||||
Subject: [PATCH] If do_beep() sees error from API, exit program
|
||||
|
||||
---
|
||||
beep.c | 12 ++++++++++--
|
||||
1 file changed, 10 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/beep.c b/beep.c
|
||||
index 2a7404e..1b9d8ca 100644
|
||||
--- a/beep.c
|
||||
+++ b/beep.c
|
||||
@@ -114,7 +114,11 @@ void do_beep(unsigned int freq) {
|
||||
switch (console_type) {
|
||||
case BEEP_TYPE_CONSOLE: if (1) {
|
||||
const uintptr_t argp = ((freq != 0) ? (CLOCK_TICK_RATE/freq) : freq) & 0xffff;
|
||||
- (void) ioctl(console_fd, KIOCSOUND, argp);
|
||||
+ if (-1 == ioctl(console_fd, KIOCSOUND, argp)) {
|
||||
+ /* If we cannot use the sound API, we cannot silence the sound either */
|
||||
+ perror("ioctl KIOCSOUND");
|
||||
+ exit(1);
|
||||
+ }
|
||||
}
|
||||
break;
|
||||
case BEEP_TYPE_EVDEV: if (1) {
|
||||
@@ -125,7 +129,11 @@ void do_beep(unsigned int freq) {
|
||||
e.code = SND_TONE;
|
||||
e.value = freq;
|
||||
|
||||
- (void) write(console_fd, &e, sizeof(struct input_event));
|
||||
+ if (sizeof(e) != write(console_fd, &e, sizeof(e))) {
|
||||
+ /* If we cannot use the sound API, we cannot silence the sound either */
|
||||
+ perror("write EV_SND");
|
||||
+ exit(1);
|
||||
+ }
|
||||
}
|
||||
break;
|
||||
case BEEP_TYPE_UNSET:
|
||||
|
|
@ -70,6 +70,10 @@ Patch13: 0013-Fix-CVE-2018-1000532-and-mitigate-against-related-is.patch
|
|||
# Update COPYING with new FSF address
|
||||
Patch14: 0014-Update-COPYING-with-new-FSF-address.patch
|
||||
|
||||
# If do_beep() sees error from API, exit program
|
||||
Patch15: 0015-If-do_beep-sees-error-from-API-exit-program.patch
|
||||
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: glibc-kernheaders
|
||||
|
||||
|
|
@ -98,6 +102,7 @@ rm -f beep.1.gz
|
|||
%patch12 -p1 -b 0012
|
||||
%patch13 -p1 -b 0013
|
||||
%patch14 -p1 -b 0014
|
||||
%patch15 -p1 -b 0015
|
||||
cp -p %{SOURCE1} README.fedora
|
||||
|
||||
|
||||
|
|
@ -137,6 +142,7 @@ install -p -m 0644 %{SOURCE4} %{SOURCE5} "$RPM_BUILD_ROOT/%{_sysconfdir}/profile
|
|||
- Update COPYING with new FSF address
|
||||
- Fix Patch9 to work as non-git patch (do the rest with shell)
|
||||
- Proper naming of Patch14
|
||||
- Exit beep when error accessing API
|
||||
|
||||
* Fri Dec 28 2018 Hans Ulrich Niedermann <hun@n-dimensional.de> - 1.3-23
|
||||
- Fix CVE-2018-1000532 and mitigate against related issues (#1595592)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue