Commit 7e7c1e4c1dd8fa7492c8e247bb9829c043c50723

Stefan Sperling 2019-01-12T21:11:48

avoid pointless call to got_error_from_errno()

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/lib/worktree.c b/lib/worktree.c
index cedb4c6..45ace73 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -526,7 +526,6 @@ install_blob(struct got_worktree *worktree, struct got_fileindex *fileindex,
 	fd = open(ondisk_path, O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW,
 	    GOT_DEFAULT_FILE_MODE);
 	if (fd == -1) {
-		err = got_error_from_errno();
 		if (errno == EEXIST) {
 			struct stat sb;
 			if (lstat(ondisk_path, &sb) == -1) {
@@ -544,7 +543,7 @@ install_blob(struct got_worktree *worktree, struct got_fileindex *fileindex,
 				update = 1;
 			}
 		} else
-			return err;
+			return got_error_from_errno();
 	}
 
 	(*progress_cb)(progress_arg,