Module Name: src Committed By: martin Date: Fri Jul 23 04:20:05 UTC 2021
Modified Files: src/usr.bin/ldd: ldd.c Log Message: gcc hates strncpy() To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/usr.bin/ldd/ldd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/ldd/ldd.c diff -u src/usr.bin/ldd/ldd.c:1.24 src/usr.bin/ldd/ldd.c:1.25 --- src/usr.bin/ldd/ldd.c:1.24 Thu Jul 22 17:39:52 2021 +++ src/usr.bin/ldd/ldd.c Fri Jul 23 04:20:05 2021 @@ -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 @@ main(int argc, char **argv) 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;