[systemd-devel] [RFC 19/25] mount-setup: skip relabelling when SELinux and SMACK not supported

Lennart Poettering lennart at poettering.net
Fri Oct 10 04:01:53 PDT 2014


On Thu, 18.09.14 15:24, Emil Renner Berthing (systemd at esmil.dk) wrote:

> This is also the only place where FTW_ACTIONRETVAL is used, so
> this makes systemd compile without SELinux or SMACK support
> when the standard library doesn't support this extension.

I applied this one. It's probably a good idea to avoid building this
bit of code if neither selinux nor SMACK are enabled. I generally
don't like littering code with #ifdefs so much, but for this one I
couldn't think of a better way.

> ---
>  src/core/mount-setup.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c
> index 23a66d2..8e91217 100644
> --- a/src/core/mount-setup.c
> +++ b/src/core/mount-setup.c
> @@ -351,6 +351,7 @@ int mount_cgroup_controllers(char ***join_controllers) {
>          return 0;
>  }
>  
> +#if defined(HAVE_SELINUX) || defined(HAVE_SMACK)
>  static int nftw_cb(
>                  const char *fpath,
>                  const struct stat *sb,
> @@ -372,6 +373,7 @@ static int nftw_cb(
>  
>          return FTW_CONTINUE;
>  };
> +#endif
>  
>  int mount_setup(bool loaded_policy) {
>          int r;
> @@ -384,6 +386,7 @@ int mount_setup(bool loaded_policy) {
>                          return r;
>          }
>  
> +#if defined(HAVE_SELINUX) || defined(HAVE_SMACK)
>          /* Nodes in devtmpfs and /run need to be manually updated for
>           * the appropriate labels, after mounting. The other virtual
>           * API file systems like /sys and /proc do not need that, they
> @@ -402,6 +405,7 @@ int mount_setup(bool loaded_policy) {
>                  log_info("Relabelled /dev and /run in %s.",
>                           format_timespan(timespan, sizeof(timespan), after_relabel - before_relabel, 0));
>          }
> +#endif
>  
>          /* Create a few default symlinks, which are normally created
>           * by udevd, but some scripts might need them before we start
> -- 
> 2.1.0
> 
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> 


Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list