[PATCH libevdev v1] fix program_invocation_short_name undeclared

Peter Hutterer peter.hutterer at who-t.net
Thu Mar 19 17:27:24 PDT 2015


On Fri, Mar 20, 2015 at 12:23:14AM +0100, Peter Seiderer wrote:
> Add fallback in case program_invocation_short_name is undeclared,
> e.g. in case of some uclibc configurations.
> 
> See [1] for a detailed buildroot failure description.
> 
> [1] http://lists.busybox.net/pipermail/buildroot/2015-March/122715.html
> 
> Signed-off-by: Peter Seiderer <ps.report at gmx.net>
> ---

question: does uclibc ignore _GNU_SOURCE or does it honour it but not expose
the program_invocation_short_name?

I'd say the latter is a bug in uclibc, if the former a basename(argv[0])
would be simpler than all those extra ifdefs for what is pretty unimportant
functionality.

Cheers,
   Peter

>  configure.ac                   | 8 ++++++++
>  tools/libevdev-tweak-device.c  | 4 ++++
>  tools/mouse-dpi-tool.c         | 4 ++++
>  tools/touchpad-edge-detector.c | 4 ++++
>  4 files changed, 20 insertions(+)
> 
> diff --git a/configure.ac b/configure.ac
> index 59c691b..e8abcc1 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -144,6 +144,14 @@ fi
>  
>  AM_CONDITIONAL(ENABLE_STATIC_SYMBOL_LEAKS_TEST, [test "x$static_symbol_leaks_test" = "xyes"])
>  
> +AC_MSG_CHECKING([for program_invocation_short_name])
> +AC_TRY_COMPILE([#define _GNU_SOURCE
> +		#include <errno.h>],
> +	[strlen(program_invocation_short_name)],
> +	AC_DEFINE(HAVE_PROGRAM_INVOCATION_SHORT_NAME, 1,
> +		[Defined if program_invocation_short_name is defined])
> +	AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
> +
>  AC_CONFIG_FILES([Makefile
>  		 libevdev/Makefile
>  		 doc/Makefile
> diff --git a/tools/libevdev-tweak-device.c b/tools/libevdev-tweak-device.c
> index f2031c2..3dacb4e 100644
> --- a/tools/libevdev-tweak-device.c
> +++ b/tools/libevdev-tweak-device.c
> @@ -36,6 +36,10 @@
>  
>  #include "libevdev.h"
>  
> +#ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME
> +static char *program_invocation_short_name = "libevdev-tweak-device";
> +#endif
> +
>  static unsigned int changes; /* bitmask of changes */
>  static struct input_absinfo absinfo;
>  static int axis;
> diff --git a/tools/mouse-dpi-tool.c b/tools/mouse-dpi-tool.c
> index be30a4d..4e396b2 100644
> --- a/tools/mouse-dpi-tool.c
> +++ b/tools/mouse-dpi-tool.c
> @@ -41,6 +41,10 @@
>  #define min(a, b) (((a) < (b)) ? (a) : (b))
>  #define max(a, b) (((a) > (b)) ? (a) : (b))
>  
> +#ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME
> +static char *program_invocation_short_name = "mouse-dpi-tool";
> +#endif
> +
>  struct measurements {
>  	int distance;
>  	double frequency;
> diff --git a/tools/touchpad-edge-detector.c b/tools/touchpad-edge-detector.c
> index e5420cf..12e1127 100644
> --- a/tools/touchpad-edge-detector.c
> +++ b/tools/touchpad-edge-detector.c
> @@ -41,6 +41,10 @@
>  #define min(a, b) (((a) < (b)) ? (a) : (b))
>  #define max(a, b) (((a) > (b)) ? (a) : (b))
>  
> +#ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME
> +static char *program_invocation_short_name = "touchpad-edge-detector";
> +#endif
> +
>  static int
>  usage(void) {
>  	printf("Usage: %s /dev/input/event0\n", program_invocation_short_name);
> -- 
> 2.1.4
> 


More information about the Input-tools mailing list