Return true if a terminal device given as PSTAT allows other users to send messages to; false otherwise */
| 293 | /* Return true if a terminal device given as PSTAT allows other users |
| 294 | to send messages to; false otherwise */ |
| 295 | static bool |
| 296 | is_tty_writable (struct stat const *pstat) |
| 297 | { |
| 298 | #ifdef TTY_GROUP_NAME |
| 299 | /* Ensure the group of the TTY device matches TTY_GROUP_NAME, more info at |
| 300 | https://bugzilla.redhat.com/454261 */ |
| 301 | struct group *ttygr = getgrnam (TTY_GROUP_NAME); |
| 302 | if (!ttygr || (pstat->st_gid != ttygr->gr_gid)) |
| 303 | return false; |
| 304 | #endif |
| 305 | |
| 306 | return pstat->st_mode & S_IWGRP; |
| 307 | } |
| 308 | |
| 309 | /* Send properly parsed USER_PROCESS info to print_line. The most |
| 310 | recent boot time is BOOTTIME. */ |