Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
commit_lock_file(): inline temporary variable
author
Michael Haggerty
<mhagger@alum.mit.edu>
Wed, 1 Oct 2014 10:28:20 +0000
(12:28 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 1 Oct 2014 20:45:13 +0000
(13:45 -0700)
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
lockfile.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
a1754bc
)
diff --git
a/lockfile.c
b/lockfile.c
index f8205f6b03b0e25a580d7b0d5b3d79caf4db53e8..e148227fb16c7e99b7a10e203cdf65f011823dea 100644
(file)
--- a/
lockfile.c
+++ b/
lockfile.c
@@
-300,12
+300,14
@@
int reopen_lock_file(struct lock_file *lk)
int commit_lock_file(struct lock_file *lk)
{
char result_file[PATH_MAX];
- size_t i;
+
if (close_lock_file(lk))
return -1;
+
strcpy(result_file, lk->filename);
- i = strlen(result_file) - LOCK_SUFFIX_LEN; /* .lock */
- result_file[i] = 0;
+ /* remove ".lock": */
+ result_file[strlen(result_file) - LOCK_SUFFIX_LEN] = 0;
+
if (rename(lk->filename, result_file))
return -1;
lk->filename[0] = 0;