chiark / gitweb /
manager: ignore invalid epoll events
[elogind.git] / src / utmp-wtmp.c
index 41589303ba63cc651aba5f775f7e0470c6bf50f7..83da640bf351c148f290592b726d8ab39d175bb0 100644 (file)
@@ -358,7 +358,7 @@ finish:
         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;
@@ -407,8 +407,9 @@ int utmp_wall(const char *message) {
                         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);
         }