Use writev(2) when reporting errors.
This commit is contained in:
parent
9a16044f94
commit
f8ee12b11b
|
@ -33,10 +33,12 @@
|
|||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
/*static char *sccsid = "from: @(#)fstab.c 5.15 (Berkeley) 2/23/91";*/
|
||||
static char *rcsid = "$Id: fstab.c,v 1.4 1994/08/13 09:03:21 pk Exp $";
|
||||
static char *rcsid = "$Id: fstab.c,v 1.5 1994/08/13 09:41:50 mycroft Exp $";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/uio.h>
|
||||
#include <fstab.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
|
@ -192,12 +194,17 @@ static
|
|||
error(err)
|
||||
int err;
|
||||
{
|
||||
char *p;
|
||||
struct iovec iov[5];
|
||||
|
||||
(void)write(STDERR_FILENO, "fstab: ", 7);
|
||||
(void)write(STDERR_FILENO, _PATH_FSTAB, sizeof(_PATH_FSTAB) - 1);
|
||||
(void)write(STDERR_FILENO, ": ", 2);
|
||||
p = strerror(err);
|
||||
(void)write(STDERR_FILENO, p, strlen(p));
|
||||
(void)write(STDERR_FILENO, "\n", 1);
|
||||
iov[0].iov_base = "fstab: ";
|
||||
iov[0].iov_len = 7;
|
||||
iov[1].iov_base = _PATH_FSTAB;
|
||||
iov[1].iov_len = sizeof(_PATH_FSTAB) - 1;
|
||||
iov[2].iov_base = ": ";
|
||||
iov[2].iov_len = 2;
|
||||
iov[3].iov_base = strerror(err);
|
||||
iov[3].iov_len = strlen(iov[3].iov_base);
|
||||
iov[4].iov_base = "\n";
|
||||
iov[4].iov_len = 1;
|
||||
(void)writev(STDERR_FILENO, iov, 5);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue