X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/aaf70a50e13231ba06df17d79147ac0d7fed6d91..80496d6edb1653bbc88c4403da048920ec6a5b59:/sbr/error.c diff --git a/sbr/error.c b/sbr/error.c index 184c9509..beb4ba6d 100644 --- a/sbr/error.c +++ b/sbr/error.c @@ -17,7 +17,7 @@ * print out error message */ void -advise (char *what, char *fmt, ...) +advise (const char *what, const char *fmt, ...) { va_list ap; @@ -31,7 +31,7 @@ advise (char *what, char *fmt, ...) * print out error message and exit */ void -adios (char *what, const char *fmt, ...) +adios (const char *what, const char *fmt, ...) { va_list ap; @@ -60,7 +60,7 @@ admonish (char *what, char *fmt, ...) * main routine for printing error messages. */ void -advertise (char *what, char *tail, const char *fmt, va_list ap) +advertise (const char *what, char *tail, const char *fmt, va_list ap) { int eindex = errno; char buffer[BUFSIZ], err[BUFSIZ]; @@ -85,7 +85,7 @@ advertise (char *what, char *tail, const char *fmt, va_list ap) if (*what) { iov->iov_len = strlen (iov->iov_base = " "); iov++; - iov->iov_len = strlen (iov->iov_base = what); + iov->iov_len = strlen (iov->iov_base = (void*)what); iov++; iov->iov_len = strlen (iov->iov_base = ": "); iov++; @@ -107,6 +107,10 @@ advertise (char *what, char *tail, const char *fmt, va_list ap) iov->iov_len = strlen (iov->iov_base = "\n"); iov++; if (writev (fileno (stderr), iob, iov - iob) < 0) { - advise ("stderr", "writev"); + snprintf(buffer, sizeof buffer, "%s: write stderr failed: %d\n", + invo_name && *invo_name ? invo_name : "nmh", errno); + if (write(2, buffer, strlen(buffer)) == -1) { + /* Ignore. if-statement needed to shut up compiler. */ + } } }