Skip to content

Commit 7645d8f

Browse files
pcloudsgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ddf362a commit 7645d8f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

grep.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,7 +1732,7 @@ static int grep_source_load_file(struct grep_source *gs)
17321732
if (lstat(filename, &st) < 0) {
17331733
err_ret:
17341734
if (errno != ENOENT)
1735-
error(_("'%s': %s"), filename, strerror(errno));
1735+
error_errno(_("failed to stat '%s'"), filename);
17361736
return -1;
17371737
}
17381738
if (!S_ISREG(st.st_mode))
@@ -1743,7 +1743,7 @@ static int grep_source_load_file(struct grep_source *gs)
17431743
goto err_ret;
17441744
data = xmallocz(size);
17451745
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);
17471747
close(i);
17481748
free(data);
17491749
return -1;

0 commit comments

Comments
 (0)