* owner/group, will probably modify bb_make_directory(...)
*/
-#include "busybox.h"
-#include "libcoreutils/coreutils.h"
#include <libgen.h>
#include <getopt.h> /* struct option */
+#include "libbb.h"
+#include "libcoreutils/coreutils.h"
+
#if ENABLE_FEATURE_INSTALL_LONG_OPTIONS
static const struct option install_long_options[] = {
{ "directory", 0, NULL, 'd' },
#if ENABLE_SELINUX
static bool use_default_selinux_context = 1;
-static void setdefaultfilecon(const char *path) {
+static void setdefaultfilecon(const char *path)
+{
struct stat s;
security_context_t scontext = NULL;
if (!is_selinux_enabled()) {
return;
- }
+ }
if (lstat(path, &s) != 0) {
return;
}
/* -c exists for backwards compatibility, it's needed */
flags = getopt32(argc, argv, "cdpsg:m:o:" USE_SELINUX("Z:"), &gid_str, &mode_str, &uid_str USE_SELINUX(, &scontext));
-
+
#if ENABLE_SELINUX
if (flags & OPT_PRESERVE_SECURITY_CONTEXT) {
use_default_selinux_context = 0;
}
if (flags & OPT_SET_SECURITY_CONTEXT) {
selinux_or_die();
- if (setfscreatecon(scontext) < 0) {
- bb_error_msg_and_die("setfscreatecon(%s)", scontext); // perror?
- }
+ setfscreatecon_or_die(scontext);
use_default_selinux_context = 0;
copy_flags |= FILEUTILS_SET_SECURITY_CONTEXT;
}