chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
selinux: also profile memory usage
[elogind.git]
/
src
/
utmp-wtmp.c
diff --git
a/src/utmp-wtmp.c
b/src/utmp-wtmp.c
index 41589303ba63cc651aba5f775f7e0470c6bf50f7..b03a3e70af9dbf8180a78763a420a6de5dcd6d92 100644
(file)
--- a/
src/utmp-wtmp.c
+++ b/
src/utmp-wtmp.c
@@
-358,7
+358,7
@@
finish:
return r;
}
return r;
}
-int utmp_wall(const char *message) {
+int utmp_wall(const char *message
, bool (*match_tty)(const char *tty)
) {
struct utmpx *u;
char date[FORMAT_TIMESTAMP_MAX];
char *text = NULL, *hn = NULL, *un = NULL, *tty = NULL;
struct utmpx *u;
char date[FORMAT_TIMESTAMP_MAX];
char *text = NULL, *hn = NULL, *un = NULL, *tty = NULL;
@@
-370,7
+370,7
@@
int utmp_wall(const char *message) {
goto finish;
}
goto finish;
}
- getttyname_
malloc(
&tty);
+ getttyname_
harder(STDIN_FILENO,
&tty);
if (asprintf(&text,
"\a\r\n"
if (asprintf(&text,
"\a\r\n"
@@
-407,8
+407,9
@@
int utmp_wall(const char *message) {
path = buf;
}
path = buf;
}
- if ((q = write_to_terminal(path, text)) < 0)
- r = q;
+ if (!match_tty || match_tty(path))
+ if ((q = write_to_terminal(path, text)) < 0)
+ r = q;
free(buf);
}
free(buf);
}