Do not error out on touching broken symlinks.
Change-Id: Id0de76db2fa65059ba9b78a13d5f6e038dfff1b8
diff --git a/cmd/slothfs-populate/main.go b/cmd/slothfs-populate/main.go
index c130edf..b7fcedb 100644
--- a/cmd/slothfs-populate/main.go
+++ b/cmd/slothfs-populate/main.go
@@ -44,7 +44,15 @@
n := 0
for _, slice := range [][]string{added, changed} {
for _, c := range slice {
- if err := os.Chtimes(c, now, now); err != nil {
+ err := os.Chtimes(c, now, now)
+ if os.IsNotExist(err) {
+ fi, statErr := os.Lstat(c)
+ if statErr == nil && fi.Mode()&os.ModeSymlink != 0 {
+ // Ignore broken symlinks.
+ err = nil
+ }
+ }
+ if err != nil {
log.Fatalf("Chtimes(%s): %v", c, err)
}
n++