Browse Source

x/sys/unix: allow nil argument slice for Utimes on Linux

Fixes golang/go#11830.

Change-Id: Ie7ffd4579a7b8143ca85a30d24acd3e2e7eece78
Reviewed-on: https://go-review.googlesource.com/12648
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Matt Layher 10 years ago
parent
commit
2c41184ab0
1 changed files with 3 additions and 0 deletions
  1. 3 0
      unix/syscall_linux.go

+ 3 - 0
unix/syscall_linux.go

@@ -93,6 +93,9 @@ func Unlinkat(dirfd int, path string) error {
 //sys	utimes(path string, times *[2]Timeval) (err error)
 
 func Utimes(path string, tv []Timeval) (err error) {
+	if tv == nil {
+		return utimes(path, nil)
+	}
 	if len(tv) != 2 {
 		return EINVAL
 	}