-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libct/init: fix and document init error logic
Currently, the code has a few issues: 1. The "unable to convert _LIBCONTAINER_INITPIPE" error from StartInitialization is never shown. 2. Errors from WriteSync and WriteJSON are never shown. 3. It's somewhat complicated. Generally, our goals are: - if there's any error, do our best to show it; - but only show each error once; - simplify the code, unify init implementations. So: - move error printing from StartInit to its callers; - do not return error from StartInit if we sent it to the parent process; - print Write* errors to stderr; Also, unify StartInitialization callers to Init: - always call os.Exit(1), since normally startInitialization does not return. If it did, it's an error. - do not panic (no one needs a long, ugly, and useless backtrace here); - add some inline comments to document all this; - libcontainer/README.md: drop an example implementation, instead refer to init.go as an always-up-to-date example. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
- Loading branch information
Showing
4 changed files
with
36 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters