summaryrefslogtreecommitdiffstats
path: root/main/beep/beep-1.2.2-nosuid.patch
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-07-24 08:01:31 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-07-24 08:01:31 +0000
commitb70981b68efcce5256eb11c6cd26ae123b10b6ea (patch)
treea38be6efae5e2ba15c2e839504632f9b7bfd5f91 /main/beep/beep-1.2.2-nosuid.patch
parent2b4df81538b8398442d5296650905c70341dd8d3 (diff)
moved extra/* to main/
and fixed misc build issues
Diffstat (limited to 'main/beep/beep-1.2.2-nosuid.patch')
-rw-r--r--main/beep/beep-1.2.2-nosuid.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/main/beep/beep-1.2.2-nosuid.patch b/main/beep/beep-1.2.2-nosuid.patch
new file mode 100644
index 00000000000..33e6affa9ff
--- /dev/null
+++ b/main/beep/beep-1.2.2-nosuid.patch
@@ -0,0 +1,33 @@
+--- beep.c.orig 2005-07-23 13:37:01.000000000 -0400
++++ beep.c 2005-07-23 14:00:55.000000000 -0400
+@@ -218,22 +218,20 @@
+ int i; /* loop counter */
+
+ /* try to snag the console */
+- if((console_fd = open("/dev/console", O_WRONLY)) == -1) {
+- fprintf(stderr, "Could not open /dev/console for writing.\n");
+- printf("\a"); /* Output the only beep we can, in an effort to fall back on usefulness */
+- perror("open");
+- exit(1);
+- }
++ console_fd = open("/dev/console", O_WRONLY);
+
+ /* Beep */
+ for (i = 0; i < parms.reps; i++) { /* start beep */
+- if(ioctl(console_fd, KIOCSOUND, (int)(CLOCK_TICK_RATE/parms.freq)) < 0) {
+- printf("\a"); /* Output the only beep we can, in an effort to fall back on usefulness */
+- perror("ioctl");
++ if (console_fd >= 0) {
++ ioctl(console_fd, KIOCSOUND, (int)(CLOCK_TICK_RATE/parms.freq));
++ } else {
++ printf("\a"); /* Output the fall back for usefulness we don't have to be suid to work at all */
++ fflush(stdout);
+ }
+ /* Look ma, I'm not ansi C compatible! */
+ usleep(1000*parms.length); /* wait... */
+- ioctl(console_fd, KIOCSOUND, 0); /* stop beep */
++ if (console_fd >= 0)
++ ioctl(console_fd, KIOCSOUND, 0); /* stop beep */
+ if(parms.end_delay || (i+1 < parms.reps))
+ usleep(1000*parms.delay); /* wait... */
+ } /* repeat. */