MCPcopy Create free account
hub / github.com/coreutils/coreutils / is_tty_writable

Function is_tty_writable

src/who.c:295–307  ·  view source on GitHub ↗

Return true if a terminal device given as PSTAT allows other users to send messages to; false otherwise */

Source from the content-addressed store, hash-verified

293/* Return true if a terminal device given as PSTAT allows other users
294 to send messages to; false otherwise */
295static bool
296is_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. */

Callers 1

print_userFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected