Instead of trying to make weak functions work on all platforms,
just use a registration function for a plugin-specific setlocale function. The sudoers version just wraps sudoers_setlocale().
This commit is contained in:
@@ -105,9 +105,9 @@ OBJS = conversation.o env_hooks.o exec.o exec_common.o exec_pty.o \
|
||||
preserve_fds.o signal.o sudo.o sudo_edit.o tgetpass.o ttyname.o \
|
||||
utmp.o @SUDO_OBJS@
|
||||
|
||||
SESH_OBJS = sesh.o exec_common.o locale_stub.o
|
||||
SESH_OBJS = sesh.o exec_common.o
|
||||
|
||||
CHECK_TTYNAME_OBJS = check_ttyname.o locale_stub.o ttyname.o
|
||||
CHECK_TTYNAME_OBJS = check_ttyname.o ttyname.o
|
||||
|
||||
LIBOBJDIR = $(top_builddir)/@ac_config_libobj_dir@/
|
||||
|
||||
@@ -287,10 +287,6 @@ load_plugins.o: $(srcdir)/load_plugins.c $(incdir)/compat/stdbool.h \
|
||||
$(srcdir)/sudo_plugin_int.h $(top_builddir)/config.h \
|
||||
$(top_builddir)/pathnames.h
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/load_plugins.c
|
||||
locale_stub.o: $(srcdir)/locale_stub.c $(incdir)/sudo_compat.h \
|
||||
$(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \
|
||||
$(top_builddir)/config.h
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $(srcdir)/locale_stub.c
|
||||
net_ifs.o: $(srcdir)/net_ifs.c $(incdir)/compat/stdbool.h \
|
||||
$(incdir)/sudo_alloc.h $(incdir)/sudo_compat.h \
|
||||
$(incdir)/sudo_conf.h $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \
|
||||
|
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2015 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if !defined(HAVE_SYS_WEAK_ALIAS)
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif /* HAVE_STRING_H */
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif /* HAVE_STRINGS_H */
|
||||
|
||||
#define DEFAULT_TEXT_DOMAIN "sudo"
|
||||
#include "sudo_gettext.h" /* must be included before sudo_compat.h */
|
||||
|
||||
#include "sudo_compat.h"
|
||||
#include "sudo_fatal.h"
|
||||
|
||||
#ifdef HAVE_LIBINTL_H
|
||||
/* No need to swap locales in the front end. */
|
||||
char *
|
||||
sudo_warn_gettext_v1(const char *msgid)
|
||||
{
|
||||
return gettext(msgid);
|
||||
}
|
||||
#endif /* HAVE_LIBINTL_H */
|
||||
|
||||
/* No need to swap locales in the front end. */
|
||||
char *
|
||||
sudo_warn_strerror_v1(int errnum)
|
||||
{
|
||||
return strerror(errnum);
|
||||
}
|
||||
|
||||
#endif /* !HAVE_SYS_WEAK_ALIAS */
|
Reference in New Issue
Block a user