]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/basic/sigbus.c
path-util: make use of TAKE_PTR() where we can
[thirdparty/systemd.git] / src / basic / sigbus.c
index 0108603fe83ddf2d1733637df85b0a78066be3fd..a065a45a8c0c8f8a35bc234950fef728690e7c7e 100644 (file)
@@ -1,29 +1,12 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
-  This file is part of systemd.
-
-  Copyright 2014 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/>.
-***/
+/* SPDX-License-Identifier: LGPL-2.1+ */
 
+#include <errno.h>
 #include <signal.h>
+#include <stddef.h>
 #include <sys/mman.h>
 
 #include "macro.h"
-#include "util.h"
+#include "memory-util.h"
 #include "sigbus.h"
 
 #define SIGBUS_QUEUE_MAX 64
@@ -130,6 +113,10 @@ void sigbus_install(void) {
                 .sa_flags = SA_SIGINFO,
         };
 
+        /* make sure that sysconf() is not called from a signal handler because
+        * it is not guaranteed to be async-signal-safe since POSIX.1-2008 */
+        (void) page_size();
+
         n_installed++;
 
         if (n_installed == 1)