err.3: EXAMPLES: use EXIT_FAILURE rather than 1 as exit status

By way of good example, use the an EXIT_* symbolic constant,
rather than a hard-coded number.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2020-06-03 22:49:36 +02:00
parent bd1686486f
commit 7ced1a6529
1 changed files with 5 additions and 4 deletions

View File

@ -147,10 +147,10 @@ information string and exit:
.EX
p = malloc(size);
if (p == NULL)
err(1, NULL);
err(EXIT_FAILURE, NULL);
fd = open(file_name, O_RDONLY, 0);
if (fd == \-1)
err(1, "%s", file_name);
err(EXIT_FAILURE, "%s", file_name);
.EE
.in
.PP
@ -159,7 +159,8 @@ Display an error message and exit:
.in +4n
.EX
if (tm.tm_hour < START_TIME)
errx(1, "too early, wait until %s", start_time_string);
errx(EXIT_FAILURE, "too early, wait until %s",
start_time_string);
.EE
.in
.PP
@ -173,7 +174,7 @@ if (fd == \-1)
raw_device, strerror(errno));
fd = open(block_device, O_RDONLY, 0);
if (fd == \-1)
err(1, "%s", block_device);
err(EXIT_FAILURE, "%s", block_device);
.EE
.in
.SH SEE ALSO