]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/shared/utmp-wtmp.c
Merge pull request #12049 from keszybz/assorted-fixups
[thirdparty/systemd.git] / src / shared / utmp-wtmp.c
index 40910876c9f690234e625b132dbb5e092c6b16a3..4b134b6c8ac6b3547a888498f03ac886148a4e67 100644 (file)
@@ -1,22 +1,4 @@
 /* SPDX-License-Identifier: LGPL-2.1+ */
-/***
-  This file is part of systemd.
-
-  Copyright 2010 Lennart Poettering
-
-  systemd is free software; you can redistribute it and/or modify it
-  under the terms of the GNU Lesser General Public License as published by
-  the Free Software Foundation; either version 2.1 of the License, or
-  (at your option) any later version.
-
-  systemd is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
 
 #include <errno.h>
 #include <fcntl.h>
 #include "fd-util.h"
 #include "hostname-util.h"
 #include "macro.h"
+#include "memory-util.h"
 #include "path-util.h"
 #include "string-util.h"
 #include "terminal-util.h"
 #include "time-util.h"
 #include "user-util.h"
-#include "util.h"
 #include "utmp-wtmp.h"
 
 int utmp_get_runlevel(int *runlevel, int *previous) {
@@ -288,7 +270,6 @@ int utmp_put_dead_process(const char *id, pid_t pid, int code, int status) {
         return write_utmp_wtmp(&store, &store_wtmp);
 }
 
-
 int utmp_put_runlevel(int runlevel, int previous) {
         struct utmpx store = {};
         int r;
@@ -330,7 +311,7 @@ static int write_to_terminal(const char *tty, const char *message) {
         assert(tty);
         assert(message);
 
-        fd = open(tty, O_WRONLY|O_NDELAY|O_NOCTTY|O_CLOEXEC);
+        fd = open(tty, O_WRONLY|O_NONBLOCK|O_NOCTTY|O_CLOEXEC);
         if (fd < 0 || !isatty(fd))
                 return -errno;
 
@@ -425,7 +406,7 @@ int utmp_wall(
                 if (u->ut_type != USER_PROCESS || u->ut_user[0] == 0)
                         continue;
 
-                /* this access is fine, because strlen("/dev/") << 32 (UT_LINESIZE) */
+                /* this access is fine, because STRLEN("/dev/") << 32 (UT_LINESIZE) */
                 if (path_startswith(u->ut_line, "/dev/"))
                         path = u->ut_line;
                 else {