Compare commits

...
Sign in to create a new pull request.

2 commits

Author SHA1 Message Date
Hans Ulrich Niedermann
86a43ba7d9 Make effect of multiple -f parameters match documentation 2016-06-04 04:31:27 +02:00
Hans Ulrich Niedermann
b2c5b9e656 Improve comment explaining beep.{sh,csh} profile files 2016-06-03 16:13:09 +02:00
4 changed files with 50 additions and 4 deletions

View file

@ -0,0 +1,38 @@
commit 07a33095b0c057373bce5f5bf66eb8c4d1c45c91
Author: Hans Ulrich Niedermann <hun@n-dimensional.de>
Date: Sat Jun 4 04:17:57 2016 +0200
Fix indentation/if brace error
As beep.c is not Python, the code blocks must be defined by
using braces instead of just indenting them differently.
Once we do that, the outcome of multiple -f parameters will
actually match what the warning message documents beep does:
Only the last -f value will be used.
Many projects proscribe using braces everywhere, but this
change keeps the beep.c coding style of using braces only
when absolutely necessary.
This issue was discovered by compiling with gcc 6.
diff --git a/beep.c b/beep.c
index 7da2e70..250be56 100644
--- a/beep.c
+++ b/beep.c
@@ -194,11 +194,12 @@ void parse_command_line(int argc, char **argv, beep_parms_t *result) {
if(!sscanf(optarg, "%f", &argfreq) || (argfreq >= 20000 /* ack! */) ||
(argfreq <= 0))
usage_bail(argv[0]);
- else
+ else {
if (result->freq != 0)
fprintf(stderr, "WARNING: multiple -f values given, only last "
"one is used.\n");
- result->freq = argfreq;
+ result->freq = argfreq;
+ }
break;
case 'l' : /* length */
if(!sscanf(optarg, "%d", &argval) || (argval < 0))

View file

@ -1,5 +1,7 @@
# Allow non-root users to call beep as root via sudo
# when configured without password in `/etc/sudoers.d/beep`.
# If `/etc/sudoers.d/beep` is configured to allow the non-root user
# access to beep without entering a password, alias `beep` to do that.
# If sudo does require a password, the non-root users will see a sudo
# error message instead of a beep error message.
if (($euid != 0) && (-x /usr/bin/beep) && (-x /usr/bin/sudo)) then
alias beep 'sudo -n /usr/bin/beep'

View file

@ -1,5 +1,7 @@
# Allow non-root users to call beep as root via sudo
# when configured without password in `/etc/sudoers.d/beep`.
# If `/etc/sudoers.d/beep` is configured to allow the non-root user
# access to beep without entering a password, alias `beep` to do that.
# If sudo does require a password, the non-root users will see a sudo
# error message instead of a beep error message.
if [ "${EUID:-}" != 0 ] && [ -x /usr/bin/beep ] && [ -x /usr/bin/sudo ]; then
alias beep='sudo -n /usr/bin/beep'

View file

@ -45,6 +45,9 @@ Patch5: 0005-Make-build-install-more-user-and-packaging-friendly.patch
# https://github.com/johnath/beep/pull/6
Patch6: 0006-Preserve-file-modification-time-on-install.patch
# Fix indentation/if brace error
Patch7: 0007-Fix-indentation-if-brace-error.patch
BuildRequires: glibc-kernheaders
@ -64,6 +67,7 @@ what's interesting, but it's real good at that notifying part.
%patch4 -p1 -b 0004
%patch5 -p1 -b 0005
%patch6 -p1 -b 0006
%patch7 -p1 -b 0007
cp -p %{SOURCE1} README.fedora