Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
grep.c: use error_errno()
author
Nguyễn Thái Ngọc Duy
<pclouds@gmail.com>
Sun, 8 May 2016 09:47:47 +0000
(16:47 +0700)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 9 May 2016 19:29:08 +0000
(12:29 -0700)
While at there, improve the error message a bit (what operation failed?)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
grep.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
ddf362a
)
diff --git
a/grep.c
b/grep.c
index 528b652f713d2b6db5f48e3829448212cc3837bf..ec6f7ffa19622f1a63a4cdd51936d1061e90fc49 100644
(file)
--- a/
grep.c
+++ b/
grep.c
@@
-1732,7
+1732,7
@@
static int grep_source_load_file(struct grep_source *gs)
if (lstat(filename, &st) < 0) {
err_ret:
if (errno != ENOENT)
if (lstat(filename, &st) < 0) {
err_ret:
if (errno != ENOENT)
- error
(_("'%s': %s"), filename, strerror(errno)
);
+ error
_errno(_("failed to stat '%s'"), filename
);
return -1;
}
if (!S_ISREG(st.st_mode))
return -1;
}
if (!S_ISREG(st.st_mode))
@@
-1743,7
+1743,7
@@
static int grep_source_load_file(struct grep_source *gs)
goto err_ret;
data = xmallocz(size);
if (st.st_size != read_in_full(i, data, size)) {
goto err_ret;
data = xmallocz(size);
if (st.st_size != read_in_full(i, data, size)) {
- error
(_("'%s': short read %s"), filename, strerror(errno)
);
+ error
_errno(_("'%s': short read"), filename
);
close(i);
free(data);
return -1;
close(i);
free(data);
return -1;