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 <gitster@pobox.com>
This commit is contained in:
5
cache.h
5
cache.h
@ -1539,8 +1539,9 @@ static inline ssize_t write_str_in_full(int fd, const char *str)
|
||||
{
|
||||
return write_in_full(fd, str, strlen(str));
|
||||
}
|
||||
__attribute__((format (printf, 3, 4)))
|
||||
extern int write_file(const char *path, int fatal, const char *fmt, ...);
|
||||
|
||||
extern int write_file(const char *path, const char *fmt, ...);
|
||||
extern int write_file_gently(const char *path, const char *fmt, ...);
|
||||
|
||||
/* pager.c */
|
||||
extern void setup_pager(void);
|
||||
|
Reference in New Issue
Block a user