Page MenuHomeFreeBSD

sbin/init/init.c: Refactor common code into execute_script()
ClosedPublic

Authored by trasz on Aug 8 2018, 2:35 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 21, 9:53 PM
Unknown Object (File)
Sep 24 2024, 6:04 PM
Unknown Object (File)
Sep 8 2024, 7:38 PM
Unknown Object (File)
Sep 8 2024, 4:26 AM
Unknown Object (File)
Sep 7 2024, 10:22 PM
Unknown Object (File)
Sep 7 2024, 6:34 AM
Unknown Object (File)
Sep 1 2024, 10:29 AM
Unknown Object (File)
Aug 19 2024, 1:34 AM
Subscribers

Details

Summary

Refactor common code into execute_script().

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 18661
Build 18346: arc lint + arc unit

Event Timeline

sbin/init/init.c
642

Is there a reason for re-evaluation of the kenv on each call to get_shell ? Can you initialize it early and then use the static string ?

1058

There are too many blank lines, all of them are excessive. Keep only the line before multi-line comment, and right after the block which was commented.

1059

I recomment to bzero() sa before setting the fields. I know that it is not present in the moved code.

1062

Just use NULL for the last arg.

1067

NULL.

1899–1900

This shell instance seems to be only used in warnings.

Either pass shell as the argument to execute_script() or modify warnings.

linimon retitled this revision from Refactor common code into execute_script() to sbin/init/init.c: Refactor common code into execute_script().Aug 9 2018, 3:52 AM
sbin/init/init.c
642

It's documented to do that in init(8), previously in loader(8):

The value of the corresponding kenv(2)
variable is evaluated every time init calls a shell script, so it
can be changed later on using the kenv(1) utility.  In
particular, if a non-default shell is used for running an
init_script, it might be desirable to have that script reset the
value of init_shell back to the default, so that the /etc/rc
script is executed with the standard shell /bin/sh.

This is fine.

BTW, %m special handling in libc/gen/syslog.c now can be removed, since fprintfv() has the %m built-in. I was initially confused to realize that %m in init.c was used for very long time.

This revision is now accepted and ready to land.Aug 9 2018, 11:18 AM
This revision was automatically updated to reflect the committed changes.