[PATCH v3] pwdgrp.c: removed assert causing runtime issues

Gedare Bloom gedare at rtems.org
Thu Mar 18 20:05:41 UTC 2021


On Thu, Mar 18, 2021 at 1:55 PM Ryan Long <ryan.long at oarcorp.com> wrote:
>
> Removed the _Assert_unused_variable_equals macro due to /etc
> having already been created by the network stack initialization
> or an initial filesystem image.
>
> Updates #4282
> ---
>  cpukit/libcsupport/src/pwdgrp.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/cpukit/libcsupport/src/pwdgrp.c b/cpukit/libcsupport/src/pwdgrp.c
> index f4a10f7..154a92a 100644
> --- a/cpukit/libcsupport/src/pwdgrp.c
> +++ b/cpukit/libcsupport/src/pwdgrp.c
> @@ -67,9 +67,13 @@ static void pwdgrp_init(void)
>
>    /*
>     * Do the best to create this directory.
> +   *
> +   * /etc could be created by the network stack initialization or an initial
> +   * filesystem image. Deliberately ignore the return value.
>     */
>    sc = mkdir("/etc", S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
> -  _Assert_Unused_variable_equals(sc, 0);
> +  _Assert((sc == 0) || (sc == -1 && errno == EEXIST));
> +  (void) sc;
>
Thanks, this looks good to me now. I would suggest looking at the
other mkdir() changes, especially the ones that haven't seen testing
yet, to think through what might be allowed behavior.

>    /*
>     *  Initialize /etc/passwd
> --
> 1.8.3.1
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list