<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 18, 2021 at 2:16 PM Ryan Long <<a href="mailto:ryan.long@oarcorp.com">ryan.long@oarcorp.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">When Joel and I looked at it, this was the only assert that prevented it from running.<br></blockquote><div><br></div><div>But Gedare's suggestion is good since it is a VERY precise check.</div><div><br></div><div>--joel </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
-----Original Message-----<br>
From: Gedare Bloom <<a href="mailto:gedare@rtems.org" target="_blank">gedare@rtems.org</a>> <br>
Sent: Thursday, March 18, 2021 2:14 PM<br>
To: Ryan Long <<a href="mailto:ryan.long@oarcorp.com" target="_blank">ryan.long@oarcorp.com</a>><br>
Cc: <a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
Subject: Re: [PATCH v2] pwdgrp.c: removed assert causing runtime issues<br>
<br>
On Thu, Mar 18, 2021 at 11:40 AM Ryan Long <<a href="mailto:ryan.long@oarcorp.com" target="_blank">ryan.long@oarcorp.com</a>> wrote:<br>
><br>
> Changed the _Assert_unused_variable_equals macro to just a (void) due <br>
> to /etc having already been created by the network stack <br>
> initialization or an initial filesystem image.<br>
><br>
> Updates #4282<br>
> ---<br>
>  cpukit/libcsupport/src/pwdgrp.c | 9 ++++-----<br>
>  1 file changed, 4 insertions(+), 5 deletions(-)<br>
><br>
> diff --git a/cpukit/libcsupport/src/pwdgrp.c <br>
> b/cpukit/libcsupport/src/pwdgrp.c index f4a10f7..edc8aff 100644<br>
> --- a/cpukit/libcsupport/src/pwdgrp.c<br>
> +++ b/cpukit/libcsupport/src/pwdgrp.c<br>
> @@ -36,7 +36,6 @@<br>
>  #include <stdint.h><br>
><br>
>  #include <rtems/seterr.h><br>
> -#include <rtems/score/assert.h><br>
><br>
>  #include "pwdgrp.h"<br>
><br>
> @@ -63,13 +62,13 @@ static void init_file(const char *name, const char *content)<br>
>   */<br>
>  static void pwdgrp_init(void)<br>
>  {<br>
> -  int sc;<br>
> -<br>
>    /*<br>
>     * Do the best to create this directory.<br>
> +   *<br>
> +   * /etc could be created by the network stack initialization or an initial<br>
> +   * filesystem image. Deliberately ignore the return value.<br>
>     */<br>
> -  sc = mkdir("/etc", S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | <br>
> S_IXOTH);<br>
> -  _Assert_Unused_variable_equals(sc, 0);<br>
> +  (void) mkdir("/etc", S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | <br>
> + S_IXOTH);<br>
><br>
<br>
So this seems fine, but it got me thinking, does this issue affect all the other mkdir-related patches recently done?<br>
<br>
Probably, we should use<br>
_Assert(sc == 0 || errno == EEXIST);<br>
(void) sc;<br>
<br>
>    /*<br>
>     *  Initialize /etc/passwd<br>
> --<br>
> 1.8.3.1<br>
><br>
> _______________________________________________<br>
> devel mailing list<br>
> <a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
> <a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div></div>