Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
apply: use error_errno() where possible
author
Christian Couder
<christian.couder@gmail.com>
Sun, 4 Sep 2016 20:18:24 +0000
(22:18 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 7 Sep 2016 19:29:53 +0000
(12:29 -0700)
To avoid possible mistakes and to uniformly show the errno
related messages, let's use error_errno() where possible.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
apply.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
9123d5d
)
diff --git
a/apply.c
b/apply.c
index 98c7f6e1100b899ca5266b797d41aa4a7465f3f5..ce09ed9cc9045a3bff4ccc100c222e75492ab834 100644
(file)
--- a/
apply.c
+++ b/
apply.c
@@
-3497,7
+3497,7
@@
static int load_current(struct apply_state *state,
ce = active_cache[pos];
if (lstat(name, &st)) {
if (errno != ENOENT)
ce = active_cache[pos];
if (lstat(name, &st)) {
if (errno != ENOENT)
- return error
(_("%s: %s"), name, strerror(errno)
);
+ return error
_errno("%s", name
);
if (checkout_target(&the_index, ce, &st))
return -1;
}
if (checkout_target(&the_index, ce, &st))
return -1;
}
@@
-3647,7
+3647,7
@@
static int check_preimage(struct apply_state *state,
} else if (!state->cached) {
stat_ret = lstat(old_name, st);
if (stat_ret && errno != ENOENT)
} else if (!state->cached) {
stat_ret = lstat(old_name, st);
if (stat_ret && errno != ENOENT)
- return error
(_("%s: %s"), old_name, strerror(errno)
);
+ return error
_errno("%s", old_name
);
}
if (state->check_index && !previous) {
}
if (state->check_index && !previous) {
@@
-3669,7
+3669,7
@@
static int check_preimage(struct apply_state *state,
} else if (stat_ret < 0) {
if (patch->is_new < 0)
goto is_new;
} else if (stat_ret < 0) {
if (patch->is_new < 0)
goto is_new;
- return error
(_("%s: %s"), old_name, strerror(errno)
);
+ return error
_errno("%s", old_name
);
}
if (!state->cached && !previous)
}
if (!state->cached && !previous)
@@
-3728,7
+3728,7
@@
static int check_to_create(struct apply_state *state,
return EXISTS_IN_WORKTREE;
} else if ((errno != ENOENT) && (errno != ENOTDIR)) {
return EXISTS_IN_WORKTREE;
} else if ((errno != ENOENT) && (errno != ENOTDIR)) {
- return error
("%s: %s", new_name, strerror(errno)
);
+ return error
_errno("%s", new_name
);
}
return 0;
}
}
return 0;
}
@@
-4247,9
+4247,9
@@
static int add_index_file(struct apply_state *state,
if (!state->cached) {
if (lstat(path, &st) < 0) {
free(ce);
if (!state->cached) {
if (lstat(path, &st) < 0) {
free(ce);
- return error(_("unable to stat newly "
-
"created file '%s': %s
"),
-
path, strerror(errno)
);
+ return error
_errno
(_("unable to stat newly "
+
"created file '%s'
"),
+
path
);
}
fill_stat_cache_info(ce, &st);
}
}
fill_stat_cache_info(ce, &st);
}
@@
-4503,7
+4503,7
@@
static int write_out_one_reject(struct apply_state *state, struct patch *patch)
rej = fopen(namebuf, "w");
if (!rej)
rej = fopen(namebuf, "w");
if (!rej)
- return error
(_("cannot open %s: %s"), namebuf, strerror(errno)
);
+ return error
_errno(_("cannot open %s"), namebuf
);
/* Normal git tools never deal with .rej, so do not pretend
* this is a git patch by saying --git or giving extended
/* Normal git tools never deal with .rej, so do not pretend
* this is a git patch by saying --git or giving extended