Merge branch 'nd/error-errno'
The code for warning_errno/die_errno has been refactored and a new error_errno() reporting helper is introduced. * nd/error-errno: (41 commits) wrapper.c: use warning_errno() vcs-svn: use error_errno() upload-pack.c: use error_errno() unpack-trees.c: use error_errno() transport-helper.c: use error_errno() sha1_file.c: use {error,die,warning}_errno() server-info.c: use error_errno() sequencer.c: use error_errno() run-command.c: use error_errno() rerere.c: use error_errno() and warning_errno() reachable.c: use error_errno() mailmap.c: use error_errno() ident.c: use warning_errno() http.c: use error_errno() and warning_errno() grep.c: use error_errno() gpg-interface.c: use error_errno() fast-import.c: use error_errno() entry.c: use error_errno() editor.c: use error_errno() diff-no-index.c: use error_errno() ...
This commit is contained in:
22
config.c
22
config.c
@ -2012,7 +2012,7 @@ int git_config_set_multivar_in_file_gently(const char *config_filename,
|
||||
lock = xcalloc(1, sizeof(struct lock_file));
|
||||
fd = hold_lock_file_for_update(lock, config_filename, 0);
|
||||
if (fd < 0) {
|
||||
error("could not lock config file %s: %s", config_filename, strerror(errno));
|
||||
error_errno("could not lock config file %s", config_filename);
|
||||
free(store.key);
|
||||
ret = CONFIG_NO_LOCK;
|
||||
goto out_free;
|
||||
@ -2026,8 +2026,7 @@ int git_config_set_multivar_in_file_gently(const char *config_filename,
|
||||
free(store.key);
|
||||
|
||||
if ( ENOENT != errno ) {
|
||||
error("opening %s: %s", config_filename,
|
||||
strerror(errno));
|
||||
error_errno("opening %s", config_filename);
|
||||
ret = CONFIG_INVALID_FILE; /* same as "invalid config file" */
|
||||
goto out_free;
|
||||
}
|
||||
@ -2111,8 +2110,7 @@ int git_config_set_multivar_in_file_gently(const char *config_filename,
|
||||
if (contents == MAP_FAILED) {
|
||||
if (errno == ENODEV && S_ISDIR(st.st_mode))
|
||||
errno = EISDIR;
|
||||
error("unable to mmap '%s': %s",
|
||||
config_filename, strerror(errno));
|
||||
error_errno("unable to mmap '%s'", config_filename);
|
||||
ret = CONFIG_INVALID_FILE;
|
||||
contents = NULL;
|
||||
goto out_free;
|
||||
@ -2121,8 +2119,7 @@ int git_config_set_multivar_in_file_gently(const char *config_filename,
|
||||
in_fd = -1;
|
||||
|
||||
if (chmod(get_lock_file_path(lock), st.st_mode & 07777) < 0) {
|
||||
error("chmod on %s failed: %s",
|
||||
get_lock_file_path(lock), strerror(errno));
|
||||
error_errno("chmod on %s failed", get_lock_file_path(lock));
|
||||
ret = CONFIG_NO_WRITE;
|
||||
goto out_free;
|
||||
}
|
||||
@ -2178,8 +2175,7 @@ int git_config_set_multivar_in_file_gently(const char *config_filename,
|
||||
}
|
||||
|
||||
if (commit_lock_file(lock) < 0) {
|
||||
error("could not write config file %s: %s", config_filename,
|
||||
strerror(errno));
|
||||
error_errno("could not write config file %s", config_filename);
|
||||
ret = CONFIG_NO_WRITE;
|
||||
lock = NULL;
|
||||
goto out_free;
|
||||
@ -2330,8 +2326,8 @@ int git_config_rename_section_in_file(const char *config_filename,
|
||||
fstat(fileno(config_file), &st);
|
||||
|
||||
if (chmod(get_lock_file_path(lock), st.st_mode & 07777) < 0) {
|
||||
ret = error("chmod on %s failed: %s",
|
||||
get_lock_file_path(lock), strerror(errno));
|
||||
ret = error_errno("chmod on %s failed",
|
||||
get_lock_file_path(lock));
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -2385,8 +2381,8 @@ int git_config_rename_section_in_file(const char *config_filename,
|
||||
fclose(config_file);
|
||||
unlock_and_out:
|
||||
if (commit_lock_file(lock) < 0)
|
||||
ret = error("could not write config file %s: %s",
|
||||
config_filename, strerror(errno));
|
||||
ret = error_errno("could not write config file %s",
|
||||
config_filename);
|
||||
out:
|
||||
free(filename_buf);
|
||||
return ret;
|
||||
|
Reference in New Issue
Block a user