Page MenuHomeFreeBSD

D32501.id96880.diff
No OneTemporary

D32501.id96880.diff

diff --git a/bin/echo/echo.c b/bin/echo/echo.c
--- a/bin/echo/echo.c
+++ b/bin/echo/echo.c
@@ -55,23 +55,6 @@
#include <string.h>
#include <unistd.h>
-/*
- * Report an error and exit.
- * Use it instead of err(3) to avoid linking-in stdio.
- */
-static __dead2 void
-errexit(const char *prog, const char *reason)
-{
- char *errstr = strerror(errno);
- write(STDERR_FILENO, prog, strlen(prog));
- write(STDERR_FILENO, ": ", 2);
- write(STDERR_FILENO, reason, strlen(reason));
- write(STDERR_FILENO, ": ", 2);
- write(STDERR_FILENO, errstr, strlen(errstr));
- write(STDERR_FILENO, "\n", 1);
- exit(1);
-}
-
int
main(int argc, char *argv[])
{
@@ -96,7 +79,7 @@
veclen = (argc >= 2) ? (argc - 2) * 2 + 1 : 0;
if ((vp = iov = malloc((veclen + 1) * sizeof(struct iovec))) == NULL)
- errexit(progname, "malloc");
+ err(1, "malloc");
while (argv[0] != NULL) {
size_t len;
@@ -135,7 +118,7 @@
nwrite = (veclen > IOV_MAX) ? IOV_MAX : veclen;
if (writev(STDOUT_FILENO, iov, nwrite) == -1)
- errexit(progname, "write");
+ err(1, "write");
iov += nwrite;
veclen -= nwrite;
}

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 23, 11:50 PM (16 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27891831
Default Alt Text
D32501.id96880.diff (1 KB)

Event Timeline