Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Feb 2023 05:30:54 GMT
From:      Zhenlei Huang <zlei@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: fcacb96b345a - stable/12 - ctfdump: Remove definitions of warn() and vwarn()
Message-ID:  <202302260530.31Q5UslK016662@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by zlei:

URL: https://cgit.FreeBSD.org/src/commit/?id=fcacb96b345a16c4619686ab388e6b77fb715828

commit fcacb96b345a16c4619686ab388e6b77fb715828
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-04-21 14:49:22 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2023-02-26 05:26:17 +0000

    ctfdump: Remove definitions of warn() and vwarn()
    
    The presence of the latter causes a link error when building a
    statically linked ctfdump(1) because libc defines the same symbol.
    libc's warn() is defined as a weak symbol and so does not cause the same
    problem, but let's just use libc's version.
    
    Reported by:    stephane rochoy <stephane.rochoy@stormshield.eu>
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 45dd2eaac379e5576f745380260470204c49beac)
    (cherry picked from commit 5def1805d144f3e95dac966d72a6fc3878ce6b98)
---
 cddl/contrib/opensolaris/tools/ctf/common/utils.c | 28 +----------------------
 cddl/contrib/opensolaris/tools/ctf/common/utils.h |  2 --
 cddl/contrib/opensolaris/tools/ctf/dump/dump.c    |  3 +--
 3 files changed, 2 insertions(+), 31 deletions(-)

diff --git a/cddl/contrib/opensolaris/tools/ctf/common/utils.c b/cddl/contrib/opensolaris/tools/ctf/common/utils.c
index 38509ec36343..fda29486d94b 100644
--- a/cddl/contrib/opensolaris/tools/ctf/common/utils.c
+++ b/cddl/contrib/opensolaris/tools/ctf/common/utils.c
@@ -24,8 +24,7 @@
  * All rights reserved.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
+#include <err.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stdarg.h>
@@ -36,31 +35,6 @@
 
 /*LINTLIBRARY*/
 
-void
-vwarn(const char *format, va_list alist)
-{
-	int err = errno;
-
-	if (pname != NULL)
-		(void) fprintf(stderr, "%s: ", pname);
-
-	(void) vfprintf(stderr, format, alist);
-
-	if (strchr(format, '\n') == NULL)
-		(void) fprintf(stderr, ": %s\n", strerror(err));
-}
-
-/*PRINTFLIKE1*/
-void
-warn(const char *format, ...)
-{
-	va_list alist;
-
-	va_start(alist, format);
-	vwarn(format, alist);
-	va_end(alist);
-}
-
 void
 vdie(const char *format, va_list alist)
 {
diff --git a/cddl/contrib/opensolaris/tools/ctf/common/utils.h b/cddl/contrib/opensolaris/tools/ctf/common/utils.h
index 9b07361a53ab..99378bb4f251 100644
--- a/cddl/contrib/opensolaris/tools/ctf/common/utils.h
+++ b/cddl/contrib/opensolaris/tools/ctf/common/utils.h
@@ -39,8 +39,6 @@ extern "C" {
 #define	E_ERROR		1		/* Exit status for error */
 #define	E_USAGE		2		/* Exit status for usage error */
 
-extern void vwarn(const char *, va_list);
-extern void warn(const char *, ...);
 extern void vdie(const char  *, va_list);
 extern void die(const char *, ...);
 
diff --git a/cddl/contrib/opensolaris/tools/ctf/dump/dump.c b/cddl/contrib/opensolaris/tools/ctf/dump/dump.c
index f3e8120192da..a4a954d97453 100644
--- a/cddl/contrib/opensolaris/tools/ctf/dump/dump.c
+++ b/cddl/contrib/opensolaris/tools/ctf/dump/dump.c
@@ -24,13 +24,12 @@
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <sys/types.h>
 #include <sys/sysmacros.h>
 #include <sys/stat.h>
 #include <sys/mman.h>
 
+#include <err.h>
 #include <strings.h>
 #include <unistd.h>
 #include <stdlib.h>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202302260530.31Q5UslK016662>