[PATCH] Fix compile error with --enable-selftest

Alexander Bokovoy ab at samba.org
Wed May 29 08:23:51 UTC 2019


On ke, 29 touko 2019, Anoop C S via samba-technical wrote:
> Hi,
> 
> Please find the attached patch which fixes the following error while
> compiling with --enable-selftest configure option:
> 
> ../../source3/utils/smbcontrol.c: In function ‘do_sleep’:
> ../../source3/utils/smbcontrol.c:435:2: error: ‘input’ undeclared
> (first use in this function)
>   435 |  input = atol(argv[1]);
>       |  ^~~~~
> ../../source3/utils/smbcontrol.c:435:2: note: each undeclared
> identifier is reported only once for each function it appears in
> ../../source3/utils/smbcontrol.c:436:27: error: ‘MAX_SLEEP’ undeclared
> (first use in this function)
>   436 |  if (input < 1 || input > MAX_SLEEP) {
>       |                           ^~~~~~~~~
> ../../source3/utils/smbcontrol.c:444:2: error: ‘seconds’ undeclared
> (first use in this function); did you mean ‘send’?
>   444 |  seconds = input;
>       |  ^~~~~~~
>       |  send
> 
> CI run: https://gitlab.com/samba-team/devel/samba/pipelines/63654943
> 
> Reviews are appreciated.
> 
> Anoop C S.

> From 15084117d6dcebbcd8112661ab1a7f0ee8efce1b Mon Sep 17 00:00:00 2001
> From: Anoop C S <anoopcs at redhat.com>
> Date: Wed, 29 May 2019 11:40:55 +0530
> Subject: [PATCH] s3-smbcontrol: Replace && with || to declare variables in
>  do_sleep()
> 
> --enable-developer internally use --enable-selftest alongside. But when
> configured only with --enable-selftest the following code block becomes
> invalid:
> 
>  #if defined(DEVELOPER) && defined(ENABLE_SELFTEST)
>         unsigned int seconds;
>         long input;
>         const long MAX_SLEEP = 60 * 60; /* One hour maximum sleep */
>  #endif
> 
> making those variables undecalred for further use. Therefore replace &&
> with || to have those variables declared with --enable-selftest
> configure option.
Please fix a typo in the commit message (undecalred). With that fix,
RB+.

> 
> Signed-off-by: Anoop C S <anoopcs at redhat.com>
> ---
>  source3/utils/smbcontrol.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
> index 7a761a6ff59..b2aa1dfa2a6 100644
> --- a/source3/utils/smbcontrol.c
> +++ b/source3/utils/smbcontrol.c
> @@ -415,7 +415,7 @@ static bool do_sleep(struct tevent_context *ev_ctx,
>  		     const struct server_id pid,
>  		     const int argc, const char **argv)
>  {
> -#if defined(DEVELOPER) && defined(ENABLE_SELFTEST)
> +#if defined(DEVELOPER) || defined(ENABLE_SELFTEST)
>  	unsigned int seconds;
>  	long input;
>  	const long MAX_SLEEP = 60 * 60; /* One hour maximum sleep */
> -- 
> 2.21.0
> 


-- 
/ Alexander Bokovoy



More information about the samba-technical mailing list