mirror of
https://github.com/containers/podman.git
synced 2025-10-17 03:04:21 +08:00
libpod: Move the creation of TmpDir to an earlier time
Later changes will need to access it earlier, so move its creation to just after the creation of StaticDir. Note: For whatever reason this we created twice before, but we now only do it once. Signed-off-by: Alexander Larsson <alexl@redhat.com>
This commit is contained in:
@ -322,6 +322,11 @@ func makeRuntime(runtime *Runtime) (retErr error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create the TmpDir if needed
|
||||||
|
if err := os.MkdirAll(runtime.config.Engine.TmpDir, 0751); err != nil {
|
||||||
|
return fmt.Errorf("creating runtime temporary files directory: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
// Set up the state.
|
// Set up the state.
|
||||||
//
|
//
|
||||||
// TODO - if we further break out the state implementation into
|
// TODO - if we further break out the state implementation into
|
||||||
@ -458,14 +463,6 @@ func makeRuntime(runtime *Runtime) (retErr error) {
|
|||||||
}
|
}
|
||||||
runtime.imageContext.SignaturePolicyPath = runtime.config.Engine.SignaturePolicyPath
|
runtime.imageContext.SignaturePolicyPath = runtime.config.Engine.SignaturePolicyPath
|
||||||
|
|
||||||
// Create the tmpDir
|
|
||||||
if err := os.MkdirAll(runtime.config.Engine.TmpDir, 0751); err != nil {
|
|
||||||
// The directory is allowed to exist
|
|
||||||
if !errors.Is(err, os.ErrExist) {
|
|
||||||
return fmt.Errorf("creating tmpdir: %w", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get us at least one working OCI runtime.
|
// Get us at least one working OCI runtime.
|
||||||
runtime.ociRuntimes = make(map[string]OCIRuntime)
|
runtime.ociRuntimes = make(map[string]OCIRuntime)
|
||||||
|
|
||||||
@ -516,14 +513,6 @@ func makeRuntime(runtime *Runtime) (retErr error) {
|
|||||||
return fmt.Errorf("no default OCI runtime was configured: %w", define.ErrInvalidArg)
|
return fmt.Errorf("no default OCI runtime was configured: %w", define.ErrInvalidArg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make the per-boot files directory if it does not exist
|
|
||||||
if err := os.MkdirAll(runtime.config.Engine.TmpDir, 0755); err != nil {
|
|
||||||
// The directory is allowed to exist
|
|
||||||
if !errors.Is(err, os.ErrExist) {
|
|
||||||
return fmt.Errorf("creating runtime temporary files directory: %w", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// the store is only set up when we are in the userns so we do the same for the network interface
|
// the store is only set up when we are in the userns so we do the same for the network interface
|
||||||
if !needsUserns {
|
if !needsUserns {
|
||||||
netBackend, netInterface, err := network.NetworkBackend(runtime.store, runtime.config, runtime.syslog)
|
netBackend, netInterface, err := network.NetworkBackend(runtime.store, runtime.config, runtime.syslog)
|
||||||
|
Reference in New Issue
Block a user