diff --git a/0007-Fix-indentation-if-brace-error.patch b/0007-Fix-indentation-if-brace-error.patch new file mode 100644 index 0000000..00f485d --- /dev/null +++ b/0007-Fix-indentation-if-brace-error.patch @@ -0,0 +1,38 @@ +commit 07a33095b0c057373bce5f5bf66eb8c4d1c45c91 +Author: Hans Ulrich Niedermann +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)) diff --git a/beep.csh b/beep.csh index 31ded7b..d8cc30a 100644 --- a/beep.csh +++ b/beep.csh @@ -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' diff --git a/beep.sh b/beep.sh index 978d024..1825537 100644 --- a/beep.sh +++ b/beep.sh @@ -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' diff --git a/beep.spec b/beep.spec index 4dc225f..e564e87 100644 --- a/beep.spec +++ b/beep.spec @@ -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