[PATCH v2] pwdgrp.c: removed assert causing runtime issues
Gedare Bloom
gedare at rtems.org
Thu Mar 18 19:23:24 UTC 2021
On Thu, Mar 18, 2021 at 1:20 PM Joel Sherrill <joel.sherrill at gmail.com> wrote:
>
>
>
> On Thu, Mar 18, 2021 at 2:16 PM Ryan Long <ryan.long at oarcorp.com> wrote:
>>
>> When Joel and I looked at it, this was the only assert that prevented it from running.
>
>
> But Gedare's suggestion is good since it is a VERY precise check.
>
We're not running tests against all of these (c.f., Chris' complaint
already). Especially, if you're not running the greth device drivers,
then you don't know if those mkdir() are likely failing with EEXIST or
not.
> --joel
>>
>>
>> -----Original Message-----
>> From: Gedare Bloom <gedare at rtems.org>
>> Sent: Thursday, March 18, 2021 2:14 PM
>> To: Ryan Long <ryan.long at oarcorp.com>
>> Cc: devel at rtems.org
>> Subject: Re: [PATCH v2] pwdgrp.c: removed assert causing runtime issues
>>
>> On Thu, Mar 18, 2021 at 11:40 AM Ryan Long <ryan.long at oarcorp.com> wrote:
>> >
>> > Changed the _Assert_unused_variable_equals macro to just a (void) due
>> > to /etc having already been created by the network stack
>> > initialization or an initial filesystem image.
>> >
>> > Updates #4282
>> > ---
>> > cpukit/libcsupport/src/pwdgrp.c | 9 ++++-----
>> > 1 file changed, 4 insertions(+), 5 deletions(-)
>> >
>> > diff --git a/cpukit/libcsupport/src/pwdgrp.c
>> > b/cpukit/libcsupport/src/pwdgrp.c index f4a10f7..edc8aff 100644
>> > --- a/cpukit/libcsupport/src/pwdgrp.c
>> > +++ b/cpukit/libcsupport/src/pwdgrp.c
>> > @@ -36,7 +36,6 @@
>> > #include <stdint.h>
>> >
>> > #include <rtems/seterr.h>
>> > -#include <rtems/score/assert.h>
>> >
>> > #include "pwdgrp.h"
>> >
>> > @@ -63,13 +62,13 @@ static void init_file(const char *name, const char *content)
>> > */
>> > static void pwdgrp_init(void)
>> > {
>> > - int sc;
>> > -
>> > /*
>> > * 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);
>> > + (void) mkdir("/etc", S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH |
>> > + S_IXOTH);
>> >
>>
>> So this seems fine, but it got me thinking, does this issue affect all the other mkdir-related patches recently done?
>>
>> Probably, we should use
>> _Assert(sc == 0 || errno == EEXIST);
>> (void) sc;
>>
>> > /*
>> > * Initialize /etc/passwd
>> > --
>> > 1.8.3.1
>> >
>> > _______________________________________________
>> > devel mailing list
>> > devel at rtems.org
>> > http://lists.rtems.org/mailman/listinfo/devel
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel
More information about the devel
mailing list