mirror of
https://github.com/clearlinux/systemd-stable.git
synced 2026-09-06 21:51:37 +00:00
timedated: correctly set context on /etc/localtime
https://bugzilla.redhat.com/show_bug.cgi?id=1190377 (cherry picked from commit fad44453ec789f49529ea5244b2c2e4d5ad1d420)
This commit is contained in:
@@ -78,3 +78,21 @@ int symlink_label(const char *old_path, const char *new_path) {
|
||||
|
||||
return mac_smack_fix(new_path, false, false);
|
||||
}
|
||||
|
||||
int symlink_label_atomic(const char *old_path, const char *new_path) {
|
||||
int r;
|
||||
|
||||
assert(old_path);
|
||||
assert(new_path);
|
||||
|
||||
r = mac_selinux_create_file_prepare(new_path, S_IFLNK);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = symlink_atomic(old_path, new_path);
|
||||
mac_selinux_create_file_clear();
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return mac_smack_fix(new_path, false, false);
|
||||
}
|
||||
|
||||
@@ -28,3 +28,4 @@ int label_fix(const char *path, bool ignore_enoent, bool ignore_erofs);
|
||||
|
||||
int mkdir_label(const char *path, mode_t mode);
|
||||
int symlink_label(const char *old_path, const char *new_path);
|
||||
int symlink_label_atomic(const char *old_path, const char *new_path);
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "clock-util.h"
|
||||
#include "conf-files.h"
|
||||
#include "path-util.h"
|
||||
#include "label.h"
|
||||
#include "fileio-label.h"
|
||||
#include "label.h"
|
||||
#include "bus-util.h"
|
||||
@@ -123,7 +124,8 @@ static int context_write_data_timezone(Context *c) {
|
||||
if (!p)
|
||||
return log_oom();
|
||||
|
||||
r = symlink_atomic(p, "/etc/localtime");
|
||||
mac_selinux_init("/etc");
|
||||
r = symlink_label_atomic(p, "/etc/localtime");
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user