LCOV - code coverage report
Current view: top level - basic - fileio-label.c (source / functions) Hit Total Coverage
Test: systemd test coverage Lines: 0 21 0.0 %
Date: 2015-07-29 18:47:03 Functions: 0 3 0.0 %

          Line data    Source code
       1             : /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
       2             : 
       3             : /***
       4             :   This file is part of systemd.
       5             : 
       6             :   Copyright 2010 Lennart Poettering
       7             :   Copyright 2010 Harald Hoyer
       8             : 
       9             :   systemd is free software; you can redistribute it and/or modify it
      10             :   under the terms of the GNU Lesser General Public License as published by
      11             :   the Free Software Foundation; either version 2.1 of the License, or
      12             :   (at your option) any later version.
      13             : 
      14             :   systemd is distributed in the hope that it will be useful, but
      15             :   WITHOUT ANY WARRANTY; without even the implied warranty of
      16             :   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
      17             :   Lesser General Public License for more details.
      18             : 
      19             :   You should have received a copy of the GNU Lesser General Public License
      20             :   along with systemd; If not, see <http://www.gnu.org/licenses/>.
      21             : ***/
      22             : 
      23             : #include "util.h"
      24             : #include "selinux-util.h"
      25             : #include "fileio-label.h"
      26             : 
      27           0 : int write_string_file_atomic_label(const char *fn, const char *line) {
      28             :         int r;
      29             : 
      30           0 :         r = mac_selinux_create_file_prepare(fn, S_IFREG);
      31           0 :         if (r < 0)
      32           0 :                 return r;
      33             : 
      34           0 :         r = write_string_file(fn, line, WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_ATOMIC);
      35             : 
      36           0 :         mac_selinux_create_file_clear();
      37             : 
      38           0 :         return r;
      39             : }
      40             : 
      41           0 : int write_env_file_label(const char *fname, char **l) {
      42             :         int r;
      43             : 
      44           0 :         r = mac_selinux_create_file_prepare(fname, S_IFREG);
      45           0 :         if (r < 0)
      46           0 :                 return r;
      47             : 
      48           0 :         r = write_env_file(fname, l);
      49             : 
      50           0 :         mac_selinux_create_file_clear();
      51             : 
      52           0 :         return r;
      53             : }
      54             : 
      55           0 : int fopen_temporary_label(const char *target,
      56             :                           const char *path, FILE **f, char **temp_path) {
      57             :         int r;
      58             : 
      59           0 :         r = mac_selinux_create_file_prepare(target, S_IFREG);
      60           0 :         if (r < 0)
      61           0 :                 return r;
      62             : 
      63           0 :         r = fopen_temporary(path, f, temp_path);
      64             : 
      65           0 :         mac_selinux_create_file_clear();
      66             : 
      67           0 :         return r;
      68             : }

Generated by: LCOV version 1.11