mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
libct: rm initWaiter
This initWaiter logic was introduced by commit4ecff8d9, but since the logic of /proc/self/exe was moved out of runc init in commit0e9a335, this seems unnecessary to have initWaiter. Remove it. This essentially reverts commit4ecff8d9. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -52,8 +52,6 @@ func TestNsenterValidPaths(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
initWaiter(t, parent)
|
||||
|
||||
if err := cmd.Wait(); err != nil {
|
||||
t.Fatalf("nsenter error: %v", err)
|
||||
}
|
||||
@@ -94,7 +92,6 @@ func TestNsenterInvalidPaths(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
initWaiter(t, parent)
|
||||
if err := cmd.Wait(); err == nil {
|
||||
t.Fatalf("nsenter exits with a zero exit status")
|
||||
}
|
||||
@@ -133,7 +130,6 @@ func TestNsenterIncorrectPathType(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
initWaiter(t, parent)
|
||||
if err := cmd.Wait(); err == nil {
|
||||
t.Fatalf("nsenter error: %v", err)
|
||||
}
|
||||
@@ -177,8 +173,6 @@ func TestNsenterChildLogging(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
initWaiter(t, parent)
|
||||
|
||||
getLogs(t, logread)
|
||||
if err := cmd.Wait(); err != nil {
|
||||
t.Fatalf("nsenter error: %v", err)
|
||||
@@ -208,22 +202,6 @@ func newPipe(t *testing.T) (parent *os.File, child *os.File) {
|
||||
return
|
||||
}
|
||||
|
||||
// initWaiter reads back the initial \0 from runc init
|
||||
func initWaiter(t *testing.T, r io.Reader) {
|
||||
inited := make([]byte, 1)
|
||||
n, err := r.Read(inited)
|
||||
if err == nil {
|
||||
if n < 1 {
|
||||
err = errors.New("short read")
|
||||
} else if inited[0] != 0 {
|
||||
err = fmt.Errorf("unexpected %d != 0", inited[0])
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
t.Fatalf("waiting for init preliminary setup: %v", err)
|
||||
}
|
||||
|
||||
func reapChildren(t *testing.T, parent *os.File) {
|
||||
t.Helper()
|
||||
decoder := json.NewDecoder(parent)
|
||||
|
||||
@@ -571,13 +571,6 @@ void nsexec(void)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Inform the parent we're past initial setup.
|
||||
* For the other side of this, see initWaiter.
|
||||
*/
|
||||
if (write(pipenum, "", 1) != 1)
|
||||
bail("could not inform the parent we are past initial setup");
|
||||
|
||||
write_log(DEBUG, "=> nsexec container setup");
|
||||
|
||||
/* Parse all of the netlink configuration. */
|
||||
|
||||
Reference in New Issue
Block a user