mirror of
https://github.com/git/git.git
synced 2024-05-19 05:56:30 +02:00
commit_lock_file(): inline temporary variable
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
a1754bcce9
commit
4f4713df94
|
@ -300,12 +300,14 @@ int reopen_lock_file(struct lock_file *lk)
|
||||||
int commit_lock_file(struct lock_file *lk)
|
int commit_lock_file(struct lock_file *lk)
|
||||||
{
|
{
|
||||||
char result_file[PATH_MAX];
|
char result_file[PATH_MAX];
|
||||||
size_t i;
|
|
||||||
if (close_lock_file(lk))
|
if (close_lock_file(lk))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
strcpy(result_file, lk->filename);
|
strcpy(result_file, lk->filename);
|
||||||
i = strlen(result_file) - LOCK_SUFFIX_LEN; /* .lock */
|
/* remove ".lock": */
|
||||||
result_file[i] = 0;
|
result_file[strlen(result_file) - LOCK_SUFFIX_LEN] = 0;
|
||||||
|
|
||||||
if (rename(lk->filename, result_file))
|
if (rename(lk->filename, result_file))
|
||||||
return -1;
|
return -1;
|
||||||
lk->filename[0] = 0;
|
lk->filename[0] = 0;
|
||||||
|
|
Loading…
Reference in New Issue