Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/ldd gcc hates strncpy()
details: https://anonhg.NetBSD.org/src/rev/91256811bfea
branches: trunk
changeset: 984780:91256811bfea
user: martin <martin%NetBSD.org@localhost>
date: Fri Jul 23 04:20:05 2021 +0000
description:
gcc hates strncpy()
diffstat:
usr.bin/ldd/ldd.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diffs (35 lines):
diff -r 487ab61e2754 -r 91256811bfea usr.bin/ldd/ldd.c
--- a/usr.bin/ldd/ldd.c Fri Jul 23 04:19:50 2021 +0000
+++ b/usr.bin/ldd/ldd.c Fri Jul 23 04:20:05 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ldd.c,v 1.24 2021/07/22 17:39:52 christos Exp $ */
+/* $NetBSD: ldd.c,v 1.25 2021/07/23 04:20:05 martin Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: ldd.c,v 1.24 2021/07/22 17:39:52 christos Exp $");
+__RCSID("$NetBSD: ldd.c,v 1.25 2021/07/23 04:20:05 martin Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -161,10 +161,13 @@
for (; argc != 0; argc--, argv++) {
int fd;
- if (**argv != '/')
- snprintf(path, sizeof(path), "%s/%s", cwd, *argv);
- else
+ if (**argv != '/') {
+ strcpy(path, cwd);
+ strlcat(path, "/", sizeof(path));
+ strlcat(path, *argv, sizeof(path));
+ } else {
strlcpy(path, *argv, sizeof(path));
+ }
fd = open(*argv, O_RDONLY);
if (fd == -1) {
exit_status = EXIT_FAILURE;
Home |
Main Index |
Thread Index |
Old Index