Commit Diff


commit - a5b57ccf597d48e3077d7bbb628bbdaa75af6f27
commit + 3eb93f3c8683453016417c3a4a8a989c7afadcdb
blob - 97ae4bcc012e101a64b51d16c5a471a8f307aacc
blob + dc493f7e516c34646e567efa01b16692c2a21501
--- lib/lockfile.c
+++ lib/lockfile.c
@@ -34,7 +34,6 @@ const struct got_error *
 got_lockfile_lock(struct got_lockfile **lf, const char *path)
 {
 	const struct got_error *err = NULL;
-	const int flags = O_RDONLY | O_CREAT | O_EXCL | O_EXLOCK;
 	int attempts = 5;
 
 	*lf = calloc(1, sizeof(**lf));
@@ -54,7 +53,9 @@ got_lockfile_lock(struct got_lockfile **lf, const char
 	}
 
 	do {
-		(*lf)->fd = open((*lf)->path, flags, GOT_DEFAULT_FILE_MODE);
+		(*lf)->fd = open((*lf)->path,
+		    O_RDONLY | O_CREAT | O_EXCL | O_EXLOCK,
+		    GOT_DEFAULT_FILE_MODE);
 		if ((*lf)->fd != -1)
 			break;
 		if (errno != EEXIST) {