Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 53132840 authored by Nick Kralevich's avatar Nick Kralevich Committed by Gerrit Code Review
Browse files

Merge "init: call restorecon on /sys"

parents 8328edb0 ae76f6db
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -945,6 +945,7 @@ int main(int argc, char **argv)
    restorecon("/dev");
    restorecon("/dev/socket");
    restorecon("/dev/__properties__");
    restorecon_recursive("/sys");

    is_charger = !strcmp(bootmode, "charger");

init/util.c

100755 → 100644
+15 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <ctype.h>
#include <errno.h>
#include <time.h>
#include <ftw.h>

#include <selinux/label.h>

@@ -519,3 +520,17 @@ int restorecon(const char *pathname)
    freecon(secontext);
    return 0;
}

static int nftw_restorecon(const char* filename, const struct stat* statptr,
    int fileflags, struct FTW* pftw)
{
    restorecon(filename);
    return 0;
}

int restorecon_recursive(const char* pathname)
{
    int fd_limit = 20;
    int flags = FTW_DEPTH | FTW_MOUNT | FTW_PHYS;
    return nftw(pathname, nftw_restorecon, fd_limit, flags);
}
+1 −0
Original line number Diff line number Diff line
@@ -41,4 +41,5 @@ void get_hardware_name(char *hardware, unsigned int *revision);
void import_kernel_cmdline(int in_qemu, void (*import_kernel_nv)(char *name, int in_qemu));
int make_dir(const char *path, mode_t mode);
int restorecon(const char *pathname);
int restorecon_recursive(const char *pathname);
#endif