- Instead of an error string, return the usual 0 or -1 and let the caller figure out what, if anything, to tell the user.
- Avoid string manipulations by opening /dev first and using openat() with O_RESOLVE_BENEATH.
- Add a boolean argument which, if false, causes ttymsg() to return without sending the message if the tty's group-writable bit is not set. This saves programs that respect this setting (like syslogd(8)) from having to check before calling ttymsg().
- Update all callers.
The observable effect of this change is minimal except for slightly
different error messages when ttymsg() fails. However, syslogd(8) will
no longer print spurious error messages on the console after trying and
failing to write a log message to an X11 session.
PR: 295171
MFC after: 1 week