summaryrefslogtreecommitdiff
path: root/lockfile.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-08-13 01:34:36 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-08-13 01:35:14 (GMT)
commiteed94a570e0421175d6b4342c0ac48e03ceedf0b (patch)
treef33864f2abffdcb83cbf626b26da34f9cc8d5bab /lockfile.c
parent4147d801db66df9b127ffe315601f467aa9d1c48 (diff)
parent01aaf1f88ddc2b99162c302710339f202996f39b (diff)
downloadgit-eed94a570e0421175d6b4342c0ac48e03ceedf0b.zip
git-eed94a570e0421175d6b4342c0ac48e03ceedf0b.tar.gz
git-eed94a570e0421175d6b4342c0ac48e03ceedf0b.tar.bz2
Merge branch 'master' into js/c-merge-recursive
Adjust to hold_lock_file_for_update() change on the master.
Diffstat (limited to 'lockfile.c')
-rw-r--r--lockfile.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/lockfile.c b/lockfile.c
index 2346e0e..2a2fea3 100644
--- a/lockfile.c
+++ b/lockfile.c
@@ -22,7 +22,7 @@ static void remove_lock_file_on_signal(int signo)
raise(signo);
}
-int hold_lock_file_for_update(struct lock_file *lk, const char *path)
+static int lock_file(struct lock_file *lk, const char *path)
{
int fd;
sprintf(lk->filename, "%s.lock", path);
@@ -41,6 +41,14 @@ int hold_lock_file_for_update(struct lock_file *lk, const char *path)
return fd;
}
+int hold_lock_file_for_update(struct lock_file *lk, const char *path, int die_on_error)
+{
+ int fd = lock_file(lk, path);
+ if (fd < 0 && die_on_error)
+ die("unable to create '%s': %s", path, strerror(errno));
+ return fd;
+}
+
int commit_lock_file(struct lock_file *lk)
{
char result_file[PATH_MAX];