Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix nsh -i/-c appending rules to daemon config files over and over
nsh -i/-c wrote daemon config files in /var/run by opening the file in append-only mode, adding a single line, closing the file again, and running chmod on the file. All this over and over, for every line. This is inefficient and also results in the problem that the full file content gets re-appended to the file each time nsh -i is run. Instead, open the file once when a new rules section is encountered, and close it when a different file needs to be written or when we can tell that we have left a "rules" section. The last open file might end up being closed implicitly when nsh -i/-c exits. While nsh -i should only be run once at boot-time which renders this issue moot, nsh -c can be run often, and the issue will also trigger during manual testing of nsh -i which is quite irritating. testing + OK Tom
- Loading branch information
94e2f97
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this ...