The patch beep-1.2.2-nosuid.patch which is applied for app-misc/beep-1.2.2-r1 has two problems: close(console_fd); does not check console_fd is valid. This causes close to result in EBADF for users without access to /dev/console. Should be no problem, but it's the same situation as with the ioctl for stopping the beep. In both cases the call will fail with EBADF if executed, unchecked, and in both cases a check before the execution is cleaner. The stop ioctl does check, so I believe close should be preceded by an "if (console_fd >= 0)" as well. bell printed to stdout, not stderr. This can cause problems in scripts that use bell, expecting no sideeffects, and redirecting their standard output. Or put differently, using stderr instead would allow the fallback to work even when stdout is redirected. The upstream release has the same problem here, I'll report this upstream as well.
Really don't need two bugs for the same thing. *** This bug has been marked as a duplicate of bug 168201 ***