mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Remove linux specific calls
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
This commit is contained in:
parent
84285f7539
commit
3dfc910d77
3 changed files with 28 additions and 12 deletions
|
@ -5,6 +5,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"compress/bzip2"
|
"compress/bzip2"
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/dotcloud/docker/utils"
|
"github.com/dotcloud/docker/utils"
|
||||||
"io"
|
"io"
|
||||||
|
@ -17,14 +18,18 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Archive io.Reader
|
type (
|
||||||
|
Archive io.Reader
|
||||||
type Compression int
|
Compression int
|
||||||
|
TarOptions struct {
|
||||||
type TarOptions struct {
|
|
||||||
Includes []string
|
Includes []string
|
||||||
Compression Compression
|
Compression Compression
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
ErrNotImplemented = errors.New("Function not implemented")
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Uncompressed Compression = iota
|
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)
|
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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// There is no LChmod, so ignore mode for symlink. Also, this
|
// There is no LChmod, so ignore mode for symlink. Also, this
|
||||||
// must happen after chown, as that can modify the file mode
|
// must happen after chown, as that can modify the file mode
|
||||||
if hdr.Typeflag != tar.TypeSymlink {
|
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
|
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)}
|
ts := []syscall.Timespec{timeToTimespec(hdr.AccessTime), timeToTimespec(hdr.ModTime)}
|
||||||
// syscall.UtimesNano doesn't support a NOFOLLOW flag atm, and
|
// syscall.UtimesNano doesn't support a NOFOLLOW flag atm, and
|
||||||
if hdr.Typeflag != tar.TypeSymlink {
|
if hdr.Typeflag != tar.TypeSymlink {
|
||||||
if err := syscall.UtimesNano(path, ts); err != nil {
|
if err := UtimesNano(path, ts); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -30,3 +30,10 @@ func LUtimesNano(path string, ts []syscall.Timespec) error {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func UtimesNano(path string, ts []syscall.Timespec) error {
|
||||||
|
if err := syscall.UtimesNano(path, ts); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// +build !linux !amd64
|
// +build !linux
|
||||||
|
|
||||||
package archive
|
package archive
|
||||||
|
|
||||||
|
@ -13,5 +13,9 @@ func getLastModification(stat *syscall.Stat_t) syscall.Timespec {
|
||||||
}
|
}
|
||||||
|
|
||||||
func LUtimesNano(path string, ts []syscall.Timespec) error {
|
func LUtimesNano(path string, ts []syscall.Timespec) error {
|
||||||
return nil
|
return ErrNotImplemented
|
||||||
|
}
|
||||||
|
|
||||||
|
func UtimesNano(path string, ts []syscall.Timespec) error {
|
||||||
|
return ErrNotImplemented
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue