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)
Apr 27 2024, 11:39 AM
Unknown Object (File)
Apr 20 2024, 4:33 AM
Unknown Object (File)
Mar 15 2024, 1:21 AM
Unknown Object (File)
Mar 15 2024, 1:21 AM
Unknown Object (File)
Mar 15 2024, 1:21 AM
Unknown Object (File)
Mar 15 2024, 1:21 AM
Unknown Object (File)
Mar 12 2024, 9:53 AM
Unknown Object (File)
Mar 11 2024, 9:43 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.