git: 45dd2eaac379 - main - ctfdump: Remove definitions of warn() and vwarn()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Thu, 21 Apr 2022 15:21:35 UTC
The branch main has been updated by markj:

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

commit 45dd2eaac379e5576f745380260470204c49beac
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-04-21 14:49:22 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-04-21 15:18:53 +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>
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
---
 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 b9db1a870165..f74eb8de40fa 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>
@@ -60,31 +59,6 @@ getpname(void)
 	return (pname);
 }
 
-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 6da2c2cf8b26..06c00a7b0e7f 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>