mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
list, utils: remove redundant code
The value of root is already an absolute path since commit
ede8a86ec1, so it does not make sense to call filepath.Abs()
again.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
"text/tabwriter"
|
||||
"time"
|
||||
@@ -116,11 +115,7 @@ func getContainers(context *cli.Context) ([]containerState, error) {
|
||||
return nil, err
|
||||
}
|
||||
root := context.GlobalString("root")
|
||||
absRoot, err := filepath.Abs(root)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
list, err := os.ReadDir(absRoot)
|
||||
list, err := os.ReadDir(root)
|
||||
if err != nil {
|
||||
fatal(err)
|
||||
}
|
||||
|
||||
+1
-6
@@ -26,12 +26,7 @@ var errEmptyID = errors.New("container id cannot be empty")
|
||||
// loadFactory returns the configured factory instance for execing containers.
|
||||
func loadFactory(context *cli.Context) (libcontainer.Factory, error) {
|
||||
root := context.GlobalString("root")
|
||||
abs, err := filepath.Abs(root)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return libcontainer.New(abs)
|
||||
return libcontainer.New(root)
|
||||
}
|
||||
|
||||
// getContainer returns the specified container instance by loading it from state
|
||||
|
||||
Reference in New Issue
Block a user