env-util: make write_env_file() optionally take headers
This also makes write_env_file() and write_env_file_label() optionally take dir_fd, and drop write_env_file_at(). Preparation for later commits.
This commit is contained in:
@@ -6,14 +6,14 @@
|
||||
#include "env-file.h"
|
||||
#include "selinux-util.h"
|
||||
|
||||
int write_env_file_label(const char *fname, char **l) {
|
||||
int write_env_file_label(int dir_fd, const char *fname, char **headers, char **l) {
|
||||
int r;
|
||||
|
||||
r = mac_selinux_create_file_prepare(fname, S_IFREG);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = write_env_file(fname, l);
|
||||
r = write_env_file(dir_fd, fname, headers, l);
|
||||
|
||||
mac_selinux_create_file_clear();
|
||||
|
||||
|
||||
@@ -5,4 +5,4 @@
|
||||
* optimize linking: This way, -lselinux is needed only for the callers of these functions that need selinux, but not
|
||||
* for all */
|
||||
|
||||
int write_env_file_label(const char *fname, char **l);
|
||||
int write_env_file_label(int dir_fd, const char *fname, char **headers, char **l);
|
||||
|
||||
@@ -208,7 +208,7 @@ int locale_context_save(LocaleContext *c, char ***ret_set, char ***ret_unset) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = write_env_file_label("/etc/locale.conf", set);
|
||||
r = write_env_file_label(AT_FDCWD, "/etc/locale.conf", NULL, set);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user