oci: fix type mismatch on some platform/arch
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
db310e9641
commit
47ea873253
3 changed files with 29 additions and 3 deletions
14
oci/finished.go
Normal file
14
oci/finished.go
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
// +build !arm !386
|
||||||
|
|
||||||
|
package oci
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"syscall"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func getFinishedTime(fi os.FileInfo) time.Time {
|
||||||
|
st := fi.Sys().(*syscall.Stat_t)
|
||||||
|
return time.Unix(st.Ctim.Sec, st.Ctim.Nsec)
|
||||||
|
}
|
14
oci/finished_32.go
Normal file
14
oci/finished_32.go
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
// +build arm 386
|
||||||
|
|
||||||
|
package oci
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"syscall"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func getFinishedTime(fi os.FileInfo) time.Time {
|
||||||
|
st := fi.Sys().(*syscall.Stat_t)
|
||||||
|
return time.Unix(int64(st.Ctim.Sec), int64(st.Ctim.Nsec))
|
||||||
|
}
|
|
@ -585,9 +585,7 @@ func (r *Runtime) UpdateStatus(c *Container) error {
|
||||||
logrus.Warnf("failed to find container exit file: %v", err)
|
logrus.Warnf("failed to find container exit file: %v", err)
|
||||||
c.state.ExitCode = -1
|
c.state.ExitCode = -1
|
||||||
} else {
|
} else {
|
||||||
st := fi.Sys().(*syscall.Stat_t)
|
c.state.Finished = getFinishedTime(fi)
|
||||||
c.state.Finished = time.Unix(st.Ctim.Sec, st.Ctim.Nsec)
|
|
||||||
|
|
||||||
statusCodeStr, err := ioutil.ReadFile(exitFilePath)
|
statusCodeStr, err := ioutil.ReadFile(exitFilePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to read exit file: %v", err)
|
return fmt.Errorf("failed to read exit file: %v", err)
|
||||||
|
|
Loading…
Reference in a new issue