diff options
author | Junio C Hamano <junkio@cox.net> | 2006-08-13 01:34:36 (GMT) |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-08-13 01:35:14 (GMT) |
commit | eed94a570e0421175d6b4342c0ac48e03ceedf0b (patch) | |
tree | f33864f2abffdcb83cbf626b26da34f9cc8d5bab /lockfile.c | |
parent | 4147d801db66df9b127ffe315601f467aa9d1c48 (diff) | |
parent | 01aaf1f88ddc2b99162c302710339f202996f39b (diff) | |
download | git-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.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -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]; |