]>
Commit | Line | Data |
---|---|---|
a5c32cff HH |
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 | #include <sys/types.h> | |
23 | #include <sys/stat.h> | |
24 | #include <unistd.h> | |
25 | ||
26 | #include "fileio-label.h" | |
27 | #include "label.h" | |
28 | ||
574d5f2d | 29 | int write_string_file_atomic_label(const char *fn, const char *line) { |
a5c32cff HH |
30 | int r; |
31 | ||
32 | r = label_context_set(fn, S_IFREG); | |
33 | if (r < 0) | |
34 | return r; | |
35 | ||
574d5f2d | 36 | write_string_file_atomic(fn, line); |
a5c32cff HH |
37 | |
38 | label_context_clear(); | |
39 | ||
40 | return r; | |
41 | } | |
42 | ||
43 | int write_env_file_label(const char *fname, char **l) { | |
44 | int r; | |
45 | ||
46 | r = label_context_set(fname, S_IFREG); | |
47 | if (r < 0) | |
48 | return r; | |
49 | ||
50 | write_env_file(fname, l); | |
51 | ||
52 | label_context_clear(); | |
53 | ||
54 | return r; | |
55 | } |