From 356a2d7faafbcbf4461f74020b490813c58f5c86 Mon Sep 17 00:00:00 2001
From: Brian Tiger Chow <brian.holderchow@gmail.com>
Date: Sun, 16 Nov 2014 10:32:08 -0800
Subject: [PATCH] fix(daemon) if lock file does not exist, then the lock is not
 acquired

@mappum @jbenet LGTU?

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
---
 daemon2/daemon.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/daemon2/daemon.go b/daemon2/daemon.go
index 4e5bd28d5..04aade68c 100644
--- a/daemon2/daemon.go
+++ b/daemon2/daemon.go
@@ -5,6 +5,7 @@ import (
 	"path"
 
 	lock "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/camlistore/lock"
+	"github.com/jbenet/go-ipfs/util"
 )
 
 // LockFile is the filename of the daemon lock, relative to config dir
@@ -15,6 +16,9 @@ func Lock(confdir string) (io.Closer, error) {
 }
 
 func Locked(confdir string) bool {
+	if !util.FileExists(path.Join(confdir, LockFile)) {
+		return false
+	}
 	if lk, err := Lock(confdir); err != nil {
 		return true
 
-- 
GitLab