Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/nc use mkstemp to prevent linker warning.
details: https://anonhg.NetBSD.org/src/rev/29fbf0904604
branches: trunk
changeset: 351326:29fbf0904604
user: christos <christos%NetBSD.org@localhost>
date: Thu Feb 09 21:23:48 2017 +0000
description:
use mkstemp to prevent linker warning.
diffstat:
usr.bin/nc/netcat.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diffs (30 lines):
diff -r 9d2f204f43e4 -r 29fbf0904604 usr.bin/nc/netcat.c
--- a/usr.bin/nc/netcat.c Thu Feb 09 21:23:11 2017 +0000
+++ b/usr.bin/nc/netcat.c Thu Feb 09 21:23:48 2017 +0000
@@ -27,7 +27,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: netcat.c,v 1.4 2017/02/09 20:37:58 joerg Exp $");
+__RCSID("$NetBSD: netcat.c,v 1.5 2017/02/09 21:23:48 christos Exp $");
/*
* Re-written nc(1) for OpenBSD. Original implementation by
@@ -425,10 +425,14 @@
if (sflag) {
unix_dg_tmp_socket = sflag;
} else {
- strlcpy(unix_dg_tmp_socket_buf, "/tmp/nc.XXXXXXXXXX",
- UNIX_DG_TMP_SOCKET_SIZE);
- if (mktemp(unix_dg_tmp_socket_buf) == NULL)
+ int fd;
+ snprintf(unix_dg_tmp_socket_buf,
+ sizeof(unix_dg_tmp_socket_buf),
+ "/tmp/%s.XXXXXXXXXX", getprogname());
+ /* XXX: abstract sockets instead? */
+ if ((fd = mkstemp(unix_dg_tmp_socket_buf)) == -1)
err(1, "mktemp");
+ close(fd);
unix_dg_tmp_socket = unix_dg_tmp_socket_buf;
}
}
Home |
Main Index |
Thread Index |
Old Index