From 12d6ce1dba504dfc5279b8d24da3edb4865c2820 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 24 Aug 2015 13:03:07 -0700 Subject: write_file(): drop "fatal" parameter All callers except three passed 1 for the "fatal" parameter to ask this function to die upon error, but to a casual reader of the code, it was not all obvious what that 1 meant. Instead, split the function into two based on a common write_file_v() that takes the flag, introduce write_file_gently() as a new way to attempt creating a file without dying on error, and make three callers to call it. Signed-off-by: Junio C Hamano --- transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'transport.c') diff --git a/transport.c b/transport.c index 40692f8ae8..0254394356 100644 --- a/transport.c +++ b/transport.c @@ -291,7 +291,7 @@ static int write_one_ref(const char *name, const struct object_id *oid, strbuf_addstr(buf, name); if (safe_create_leading_directories(buf->buf) || - write_file(buf->buf, 0, "%s\n", oid_to_hex(oid))) + write_file_gently(buf->buf, "%s\n", oid_to_hex(oid))) return error("problems writing temporary file %s: %s", buf->buf, strerror(errno)); strbuf_setlen(buf, len); -- cgit v1.2.3