rtems-kernel-init.c tries to re-make existing "/etc"

Peter Dufault dufault at hda.com
Thu Apr 18 15:14:03 UTC 2024



> On Apr 18, 2024, at 10:55 AM, Joel Sherrill <joel at rtems.org> wrote:
> 
> 
> 
> On Thu, Apr 18, 2024 at 9:50 AM Peter Dufault <dufault at hda.com> wrote:
> 
> 
> > On Apr 18, 2024, at 10:34 AM, Kinsey Moore <kinsey.moore at oarcorp.com> wrote:
> > 
> > A patch for EEXIST here should be fine. It would be nice if the caller were more resilient.
> > 
> 
> I also changed "default-network-init.h" to assert rtems_bsd_initialize() worked.
> 
>   sc = rtems_bsd_initialize();
>   assert(sc == RTEMS_SUCCESSFUL);
> 
> At least you get a panic message.  I'll submit a patch.
> 
> Why does /etc already exist? Is it really an error if it already exists?
> 
> If the startup code untar'ed some initial file system contents before calling this, then /etc would almost certainly exist.
> 
> Unless I am missing something EEXIST should be acceptable. Other errors are most likely really fatal.
> 
> https://pubs.opengroup.org/onlinepubs/9699919799/functions/mkdir.html
> 
> --joel 
> 
> Peter
> -----------------
> Peter Dufault
> HD Associates, Inc.      Software and System Engineering
> 

Oh, and maybe you misunderstood: The "assert()" is in *addition* to allowing EEXIST for the "mkdir()" call.  It avoids a weird crash in case "rtems_bsd_initialize()" fails for some other reason.

Peter
-----------------
Peter Dufault
HD Associates, Inc.      Software and System Engineering





More information about the devel mailing list