[PATCH] /run should be created if missing at startup

Alexander Bokovoy ab at samba.org
Tue Apr 24 05:34:01 UTC 2018


On ke, 18 huhti 2018, William Brown via samba-technical wrote:
> Hi,
> 
> This patch fixes a minor issue in containers where you overlay /var
> into the location. If /run is missing samba won't start. This patch
> allows samba to attempt to recreate /run if it is missing at start up.
> 
> Thanks,
> 
> William

> From 028ed1b0bbfc7173b788abefb7b43f935ebbcc4e Mon Sep 17 00:00:00 2001
> From: William Brown <william at blackhats.net.au>
> Date: Wed, 18 Apr 2018 19:44:33 +1000
> Subject: [PATCH] s4/smbd/server.c: create /run if missing
> 
> In some cases (containers mainly) /var/run may not be present. Instead of
> erroring, we should create it at startup.
> 
> Signed-off-by: William Brown <william at blackhats.net.au>
> ---
>  source4/smbd/server.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/source4/smbd/server.c b/source4/smbd/server.c
> index 431fbad3139..beac4fff0ca 100644
> --- a/source4/smbd/server.c
> +++ b/source4/smbd/server.c
> @@ -498,6 +498,10 @@ static int binary_smbd_main(const char *binary_name,
>  		mkdir(lpcfg_lock_directory(cmdline_lp_ctx), 0755);
>  	}
>  
> +	if (!directory_exist(lpcfg_pid_directory(cmdline_lp_ctx))) {
> +		mkdir(lpcfg_pid_directory(cmdline_lp_ctx), 0755);
> +	}
> +
>  	pidfile_create(lpcfg_pid_directory(cmdline_lp_ctx), binary_name);
>  
>  	if (lpcfg_server_role(cmdline_lp_ctx) == ROLE_ACTIVE_DIRECTORY_DC) {
Looking at source3/smbd/server.c, we do create lpcfg_pid_directory()
there already, so this puts source4/smbd on par with source3/smbd.

RB+ from my side. One more team reviewer, please!

-- 
/ Alexander Bokovoy



More information about the samba-technical mailing list