File: chtimes_nolinux.go

package info (click to toggle)
golang-github-tonistiigi-fsutil 0.0~git20240925.a340068-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 644 kB
  • sloc: sh: 21; makefile: 5
file content (22 lines) | stat: -rw-r--r-- 346 bytes parent folder | download | duplicates (17)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// +build !linux

package fsutil

import (
	"os"
	"time"

	"github.com/pkg/errors"
)

func chtimes(path string, un int64) error {
	mtime := time.Unix(0, un)
	fi, err := os.Lstat(path)
	if err != nil {
		return errors.WithStack(err)
	}
	if fi.Mode()&os.ModeSymlink != 0 {
		return nil
	}
	return errors.WithStack(os.Chtimes(path, mtime, mtime))
}