Commit Diff


commit - e88d208e6f46e0ecdb19a28cdb55a09983bee0da091069d56e3be6d030bae5c7
commit + 36db96a6957014002a6b8e2ab2e26868eff8ec6cb4b46718b8b10eb4533e8211
blob - 69dccac832906271d4c6829b2f75d980724effa260cc533acaa8530b8272775f
blob + 7648ff56587c76311e1786402ffbae91f8ec6f7a756b59c1cb94809ebc8ca4eb
--- lib/worktree_open.c	
+++ lib/worktree_open.c	
@@ -117,7 +117,7 @@ done:
 
 static const struct got_error *
 open_worktree(struct got_worktree **worktree, const char *path,
-    const char *meta_dir, int flags)
+    const char *meta_dir, int lock_flag)
 {
 	const struct got_error *err = NULL;
 	char *path_meta;
@@ -150,7 +150,7 @@ open_worktree(struct got_worktree **worktree, const ch
 		goto done;
 	}
 
-	fd = open(path_lock, O_RDWR | flags | O_NONBLOCK | O_CLOEXEC);
+	fd = open(path_lock, O_RDWR | lock_flag | O_NONBLOCK | O_CLOEXEC);
 	if (fd == -1) {
 		err = (errno == EWOULDBLOCK ? got_error(GOT_ERR_WORKTREE_BUSY)
 		    : got_error_from_errno2("open", path_lock));
@@ -281,7 +281,7 @@ done:
 
 static const struct got_error *
 find_worktree(struct got_worktree **worktree, const char *path,
-    const char *meta_dir, int flags)
+    const char *meta_dir, int lock_flag)
 {
 	const struct got_error *err = NULL;
 	char *worktree_path;
@@ -301,7 +301,7 @@ find_worktree(struct got_worktree **worktree, const ch
 		if (meta_dir == NULL) {
 			for (i = 0; i < nitems(meta_dirs); i++) {
 				err = open_worktree(worktree, worktree_path,
-				    meta_dirs[i], flags);
+				    meta_dirs[i], lock_flag);
 				if (err == NULL ||
 				    err->code == GOT_ERR_WORKTREE_BUSY)
 					break;
@@ -313,7 +313,7 @@ find_worktree(struct got_worktree **worktree, const ch
 			}
 		} else
 			err = open_worktree(worktree, worktree_path, meta_dir,
-			    flags);
+			    lock_flag);
 		if (err && !(err->code == GOT_ERR_ERRNO && errno == ENOENT)) {
 			free(worktree_path);
 			return err;