Merge pull request #3983 from creack/remove_linux_specific

Remove linux specific calls
This commit is contained in:
Guillaume J. Charmes 2014-02-10 12:10:38 -08:00
commit 19e01a6363
3 changed files with 28 additions and 12 deletions

View File

@ -5,6 +5,7 @@ import (
"bytes"
"compress/bzip2"
"compress/gzip"
"errors"
"fmt"
"github.com/dotcloud/docker/utils"
"io"
@ -17,14 +18,18 @@ import (
"syscall"
)
type Archive io.Reader
type (
Archive io.Reader
Compression int
TarOptions struct {
Includes []string
Compression Compression
}
)
type Compression int
type TarOptions struct {
Includes []string
Compression Compression
}
var (
ErrNotImplemented = errors.New("Function not implemented")
)
const (
Uncompressed Compression = iota
@ -236,14 +241,14 @@ func createTarFile(path, extractDir string, hdr *tar.Header, reader *tar.Reader)
return fmt.Errorf("Unhandled tar header type %d\n", hdr.Typeflag)
}
if err := syscall.Lchown(path, hdr.Uid, hdr.Gid); err != nil {
if err := os.Lchown(path, hdr.Uid, hdr.Gid); err != nil {
return err
}
// There is no LChmod, so ignore mode for symlink. Also, this
// must happen after chown, as that can modify the file mode
if hdr.Typeflag != tar.TypeSymlink {
if err := syscall.Chmod(path, uint32(hdr.Mode&07777)); err != nil {
if err := os.Chmod(path, os.FileMode(hdr.Mode&07777)); err != nil {
return err
}
}
@ -251,7 +256,7 @@ func createTarFile(path, extractDir string, hdr *tar.Header, reader *tar.Reader)
ts := []syscall.Timespec{timeToTimespec(hdr.AccessTime), timeToTimespec(hdr.ModTime)}
// syscall.UtimesNano doesn't support a NOFOLLOW flag atm, and
if hdr.Typeflag != tar.TypeSymlink {
if err := syscall.UtimesNano(path, ts); err != nil {
if err := UtimesNano(path, ts); err != nil {
return err
}
} else {

View File

@ -30,3 +30,10 @@ func LUtimesNano(path string, ts []syscall.Timespec) error {
return nil
}
func UtimesNano(path string, ts []syscall.Timespec) error {
if err := syscall.UtimesNano(path, ts); err != nil {
return err
}
return nil
}

View File

@ -1,4 +1,4 @@
// +build !linux !amd64
// +build !linux
package archive
@ -13,5 +13,9 @@ func getLastModification(stat *syscall.Stat_t) syscall.Timespec {
}
func LUtimesNano(path string, ts []syscall.Timespec) error {
return nil
return ErrNotImplemented
}
func UtimesNano(path string, ts []syscall.Timespec) error {
return ErrNotImplemented
}