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:
parent
cda31e7349
commit
45dd2eaac3
@ -24,8 +24,7 @@
|
|||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
#include <err.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@ -60,31 +59,6 @@ getpname(void)
|
|||||||
return (pname);
|
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
|
void
|
||||||
vdie(const char *format, va_list alist)
|
vdie(const char *format, va_list alist)
|
||||||
{
|
{
|
||||||
|
@ -39,8 +39,6 @@ extern "C" {
|
|||||||
#define E_ERROR 1 /* Exit status for error */
|
#define E_ERROR 1 /* Exit status for error */
|
||||||
#define E_USAGE 2 /* Exit status for usage 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 vdie(const char *, va_list);
|
||||||
extern void die(const char *, ...);
|
extern void die(const char *, ...);
|
||||||
|
|
||||||
|
@ -24,13 +24,12 @@
|
|||||||
* Use is subject to license terms.
|
* Use is subject to license terms.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma ident "%Z%%M% %I% %E% SMI"
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/sysmacros.h>
|
#include <sys/sysmacros.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
|
||||||
|
#include <err.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user