Re: purge_secrets missing return on non-void function

"Schanzenbach, Martin" <[email protected]> Mon, 25 Sep 2023 14:39:44 +0200
Newsgroups gmane.network.gnunet.devel
Message-ID <[email protected]>
Hi,

it is thanks. I just fixed it in git head.

BR
Martin

On 25.09.23 14:18, Andreas Stieger wrote:
> Hello,
> 
> I am not sure if this is new as of 0.20.0 or earlier, but this seems to
> be related to bb4036:
> 
> [   50s] gnunet-communicator-udp.c: In function 'purge_secrets':
> [   50s] gnunet-communicator-udp.c:1401:1: error: no return statement in
> function returning non-void [-Werror=return-type]
> [   50s]  1401 | }
> [   50s]       | ^
> 
> The documented intent here is to return an GNUNET_GenericReturnValue,
> specifically if GNUNET_YES if any secret was deleted. It actually does
> the counting but the GNUNET_YES/GNUNET_NO logic seems to be missing.
> 
> So the following makes sense:
> 
> Index: gnunet-0.20.0/src/transport/gnunet-communicator-udp.c
> ===================================================================
> --- gnunet-0.20.0.orig/src/transport/gnunet-communicator-udp.c
> +++ gnunet-0.20.0/src/transport/gnunet-communicator-udp.c
> @@ -1398,6 +1398,10 @@ purge_secrets (struct SharedSecret *ss_l
>     }
>     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
>                 "Finished purging all, deleted %u.\n", deleted);
> +  if (deleted > 0) {
> +    return GNUNET_YES;
> +  }
> +  return GNUNET_NO;
>   }
> 
> 
> Andreas
> 
>