grep.c: use error_errno()
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>
Nguyễn Thái Ngọc Duy committed
May 8, 2016 at 16:47 UTC
7645d8f119997320c33423d95670824f05657bbb
1 file changed
+2
-2
grep.c
+2
-2
@@ -1732,7 +1732,7 @@ static int grep_source_load_file(struct grep_source *gs)
1732
if (lstat(filename, &st) < 0) {
1733
err_ret:
1734
if (errno != ENOENT)
1735
- error(_("'%s': %s"), filename, strerror(errno));
1735
+ error_errno(_("failed to stat '%s'"), filename);
1736
return -1;
1737
}
1738
if (!S_ISREG(st.st_mode))
@@ -1743,7 +1743,7 @@ static int grep_source_load_file(struct grep_source *gs)
1743
goto err_ret;
1744
data = xmallocz(size);
1745
if (st.st_size != read_in_full(i, data, size)) {
1746
- error(_("'%s': short read %s"), filename, strerror(errno));
1746
+ error_errno(_("'%s': short read"), filename);
1747
close(i);
1748
free(data);
1749
return -1;