Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/lpr/lpd Avoid printing a useless \0. From SHIMIZU R...
details: https://anonhg.NetBSD.org/src/rev/d7fd1e22d918
branches: trunk
changeset: 569609:d7fd1e22d918
user: wiz <wiz%NetBSD.org@localhost>
date: Thu Aug 26 13:05:14 2004 +0000
description:
Avoid printing a useless \0. From SHIMIZU Ryo in PR 26766.
diffstat:
usr.sbin/lpr/lpd/printjob.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diffs (50 lines):
diff -r 99190bcf10b5 -r d7fd1e22d918 usr.sbin/lpr/lpd/printjob.c
--- a/usr.sbin/lpr/lpd/printjob.c Thu Aug 26 10:12:33 2004 +0000
+++ b/usr.sbin/lpr/lpd/printjob.c Thu Aug 26 13:05:14 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: printjob.c,v 1.39 2003/08/07 11:25:28 agc Exp $ */
+/* $NetBSD: printjob.c,v 1.40 2004/08/26 13:05:14 wiz Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)printjob.c 8.7 (Berkeley) 5/10/95";
#else
-__RCSID("$NetBSD: printjob.c,v 1.39 2003/08/07 11:25:28 agc Exp $");
+__RCSID("$NetBSD: printjob.c,v 1.40 2004/08/26 13:05:14 wiz Exp $");
#endif
#endif /* not lint */
@@ -61,6 +61,7 @@
#include <pwd.h>
#include <unistd.h>
+#include <sys/uio.h>
#include <signal.h>
#include <termios.h>
#include <syslog.h>
@@ -1617,6 +1618,7 @@
int fd;
char *buf;
va_list ap;
+ struct iovec iov[2];
umask(0);
fd = open(ST, O_WRONLY|O_CREAT, 0664);
@@ -1628,9 +1630,12 @@
va_start(ap, msg);
(void)vasprintf(&buf, msg, ap);
va_end(ap);
- /* XXX writev */
- (void)write(fd, buf, strlen(buf));
- (void)write(fd, "\n", 2);
+
+ iov[0].iov_base = buf;
+ iov[0].iov_len = strlen(buf);
+ iov[1].iov_base = "\n";
+ iov[1].iov_len = 1;
+ (void)writev(fd, iov, 2);
(void)close(fd);
free(buf);
}
Home |
Main Index |
Thread Index |
Old Index