diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-09-01 16:31:26 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-09-01 16:31:27 -0700 |
commit | 0fb8e2423444e104004062ff34f6f6f594c0ff80 (patch) | |
tree | ff7d26b76e41e69c3d9b0a89feb23bcaa1440066 /lockfile.c | |
parent | Merge branch 'rs/archive-zip-many' (diff) | |
parent | lockfile: remove function "hold_lock_file_for_append" (diff) | |
download | tgif-0fb8e2423444e104004062ff34f6f6f594c0ff80.tar.xz |
Merge branch 'rt/remove-hold-lockfile-for-append'
* rt/remove-hold-lockfile-for-append:
lockfile: remove function "hold_lock_file_for_append"
Diffstat (limited to 'lockfile.c')
-rw-r--r-- | lockfile.c | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/lockfile.c b/lockfile.c index 637b8cf743..80d056d2ed 100644 --- a/lockfile.c +++ b/lockfile.c @@ -177,44 +177,6 @@ int hold_lock_file_for_update_timeout(struct lock_file *lk, const char *path, return fd; } -int hold_lock_file_for_append(struct lock_file *lk, const char *path, int flags) -{ - int fd, orig_fd; - - fd = lock_file(lk, path, flags); - if (fd < 0) { - if (flags & LOCK_DIE_ON_ERROR) - unable_to_lock_die(path, errno); - return fd; - } - - orig_fd = open(path, O_RDONLY); - if (orig_fd < 0) { - if (errno != ENOENT) { - int save_errno = errno; - - if (flags & LOCK_DIE_ON_ERROR) - die("cannot open '%s' for copying", path); - rollback_lock_file(lk); - error("cannot open '%s' for copying", path); - errno = save_errno; - return -1; - } - } else if (copy_fd(orig_fd, fd)) { - int save_errno = errno; - - if (flags & LOCK_DIE_ON_ERROR) - die("failed to prepare '%s' for appending", path); - close(orig_fd); - rollback_lock_file(lk); - errno = save_errno; - return -1; - } else { - close(orig_fd); - } - return fd; -} - char *get_locked_file_path(struct lock_file *lk) { struct strbuf ret = STRBUF_INIT; |