aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-08-22 15:19:43 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-08-22 15:19:43 +0200
commit617c295ec0e0454cbc723a148ed4aadc0b631653 (patch)
tree86e549337cbcdedc772aaf9a297d05a528e3f870 /internal
parent8f3a9f1e2f0c9e066d2e3894b9fc2d054d2f148e (diff)
downloadfeed2imap-go-617c295ec0e0454cbc723a148ed4aadc0b631653.tar.gz
feed2imap-go-617c295ec0e0454cbc723a148ed4aadc0b631653.tar.bz2
feed2imap-go-617c295ec0e0454cbc723a148ed4aadc0b631653.zip
Lock file names must be absolute
Diffstat (limited to 'internal')
-rw-r--r--internal/feed/cache.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/internal/feed/cache.go b/internal/feed/cache.go
index 2d8f9aa..4453246 100644
--- a/internal/feed/cache.go
+++ b/internal/feed/cache.go
@@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"os"
+ "path/filepath"
"time"
"github.com/nightlyone/lockfile"
@@ -51,12 +52,16 @@ func cacheForVersion(version Version) (CacheImpl, error) {
}
}
-func lockName(fileName string) string {
- return fileName + ".lck"
+func lockName(fileName string) (string, error) {
+ return filepath.Abs(fileName + ".lck")
}
func lock(fileName string) (lock lockfile.Lockfile, err error) {
- lockFile := lockName(fileName)
+ var lockFile string
+
+ if lockFile, err = lockName(fileName); err != nil {
+ return
+ }
log.Debugf("Handling lock file '%s'", lockFile)
if lock, err = lockfile.New(lockFile); err != nil {