summaryrefslogtreecommitdiff
path: root/src/head.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/head.c')
-rw-r--r--src/head.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/head.c b/src/head.c
index 282c2ea8d..21ace70b4 100644
--- a/src/head.c
+++ b/src/head.c
@@ -31,6 +31,7 @@
#include "system.h"
+#include "die.h"
#include "error.h"
#include "full-read.h"
#include "quote.h"
@@ -180,8 +181,8 @@ xwrite_stdout (char const *buffer, size_t n_bytes)
if (n_bytes > 0 && fwrite (buffer, 1, n_bytes, stdout) < n_bytes)
{
clearerr (stdout); /* To avoid redundant close_stdout diagnostic. */
- error (EXIT_FAILURE, errno, _("error writing %s"),
- quoteaf ("standard output"));
+ die (EXIT_FAILURE, errno, _("error writing %s"),
+ quoteaf ("standard output"));
}
}
@@ -270,8 +271,8 @@ elide_tail_bytes_pipe (const char *filename, int fd, uintmax_t n_elide_0,
if (SIZE_MAX < n_elide_0 + READ_BUFSIZE)
{
char umax_buf[INT_BUFSIZE_BOUND (n_elide_0)];
- error (EXIT_FAILURE, 0, _("%s: number of bytes is too large"),
- umaxtostr (n_elide_0, umax_buf));
+ die (EXIT_FAILURE, 0, _("%s: number of bytes is too large"),
+ umaxtostr (n_elide_0, umax_buf));
}
/* Two cases to consider...
@@ -1074,8 +1075,8 @@ main (int argc, char **argv)
if ( ! count_lines && elide_from_end && OFF_T_MAX < n_units)
{
char umax_buf[INT_BUFSIZE_BOUND (n_units)];
- error (EXIT_FAILURE, EOVERFLOW, "%s: %s", _("invalid number of bytes"),
- quote (umaxtostr (n_units, umax_buf)));
+ die (EXIT_FAILURE, EOVERFLOW, "%s: %s", _("invalid number of bytes"),
+ quote (umaxtostr (n_units, umax_buf)));
}
file_list = (optind < argc
@@ -1089,7 +1090,7 @@ main (int argc, char **argv)
ok &= head_file (file_list[i], n_units, count_lines, elide_from_end);
if (have_read_stdin && close (STDIN_FILENO) < 0)
- error (EXIT_FAILURE, errno, "-");
+ die (EXIT_FAILURE, errno, "-");
return ok ? EXIT_SUCCESS : EXIT_FAILURE;
}