LCOV - code coverage report
Current view: top level - shared - fileio-label.c (source / functions) Hit Total Coverage
Test: main_coverage.info Lines: 0 12 0.0 %
Date: 2019-08-22 15:41:25 Functions: 0 2 0.0 %

          Line data    Source code
       1             : /* SPDX-License-Identifier: LGPL-2.1+ */
       2             : 
       3             : #include <sys/stat.h>
       4             : 
       5             : #include "fileio-label.h"
       6             : #include "fileio.h"
       7             : #include "selinux-util.h"
       8             : 
       9           0 : int write_string_file_atomic_label_ts(const char *fn, const char *line, struct timespec *ts) {
      10             :         int r;
      11             : 
      12           0 :         r = mac_selinux_create_file_prepare(fn, S_IFREG);
      13           0 :         if (r < 0)
      14           0 :                 return r;
      15             : 
      16           0 :         r = write_string_file_ts(fn, line, WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_ATOMIC, ts);
      17             : 
      18           0 :         mac_selinux_create_file_clear();
      19             : 
      20           0 :         return r;
      21             : }
      22             : 
      23           0 : int create_shutdown_run_nologin_or_warn(void) {
      24             :         int r;
      25             : 
      26             :         /* This is used twice: once in systemd-user-sessions.service, in order to block logins when we actually go
      27             :          * down, and once in systemd-logind.service when shutdowns are scheduled, and logins are to be turned off a bit
      28             :          * in advance. We use the same wording of the message in both cases. */
      29             : 
      30           0 :         r = write_string_file_atomic_label("/run/nologin",
      31             :                                            "System is going down. Unprivileged users are not permitted to log in anymore. "
      32             :                                            "For technical details, see pam_nologin(8).");
      33           0 :         if (r < 0)
      34           0 :                 return log_error_errno(r, "Failed to create /run/nologin: %m");
      35             : 
      36           0 :         return 0;
      37             : }

Generated by: LCOV version 1.14