git: 5def1805d144 - stable/13 - ctfdump: Remove definitions of warn() and vwarn()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 28 Apr 2022 00:34:54 UTC
The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5def1805d144f3e95dac966d72a6fc3878ce6b98 commit 5def1805d144f3e95dac966d72a6fc3878ce6b98 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2022-04-21 14:49:22 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2022-04-28 00:34:39 +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) --- 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>