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
This commit is contained in:
Mark Johnston 2022-04-21 10:49:22 -04:00
parent cda31e7349
commit 45dd2eaac3
3 changed files with 2 additions and 31 deletions

View File

@ -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)
{

View File

@ -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 *, ...);

View File

@ -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>