When executing dog cluster snapshot command, valgrind report
"Warning: invalid file descriptor -1 in syscall close()".

This patch fix the problem.

Signed-off-by: Ruoyu <lian...@ucweb.com>
---
 dog/farm/snap.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/dog/farm/snap.c b/dog/farm/snap.c
index ff03047..9040369 100644
--- a/dog/farm/snap.c
+++ b/dog/farm/snap.c
@@ -36,10 +36,11 @@ int snap_init(const char *farm_dir)
 
        fd = open(snap_log_path, O_CREAT | O_EXCL, 0666);
        if (fd < 0) {
-               if (errno != EEXIST) {
+               if (errno != EEXIST)
                        sd_err("%m");
-                       goto out;
-               }
+               else
+                       ret = 0;
+               goto out;
        }
 
        ret = 0;
-- 
1.8.3.2


-- 
sheepdog mailing list
sheepdog@lists.wpkg.org
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to