oci: fix type mismatch on some platform/arch

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2017-07-17 15:31:12 +02:00
parent db310e9641
commit 47ea873253
No known key found for this signature in database
GPG key ID: B2BEAD150DE936B9
3 changed files with 29 additions and 3 deletions

14
oci/finished.go Normal file
View 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
View 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))
}

View file

@ -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)