From 8cfebd2f8bd3daf4b86e89971e5a7f08912e996e Mon Sep 17 00:00:00 2001 From: AngelCarpintero Date: Wed, 15 Jul 2009 18:18:53 +0000 Subject: [PATCH] Avoid segfault detecting strerror_r() version GNU or SUSv3 --- CHANGELOG | 3 ++- CREDITS | 2 ++ configure | 18 +++++++++--------- logger.c | 6 ++++-- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 19a90c1f..fdee5ebb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -30,8 +30,9 @@ Bugfixes * Avoid possible stack smashing in v4l_open_vidpipe(). (Angel Carpintero) * Allow compile with OpenSuse ffmpeg package (15594svn-20081010) http://www.lavrsen.dk/twiki/bin/view/Motion/SupportQuestion2008x10x25x070400 (Angel Carpintero) - * Fix warning for __USE_GNU redefined + * Fix warning for __USE_GNU redefined (Peter Holik) http://www.lavrsen.dk/foswiki/bin/view/Motion/BugReport2009x06x17x122137 (Peter Holik) + * Avoid segfault detecting strerror_r() version GNU or SUSv3. (Angel Carpintero) * Fix Segfault on reload or quit for vloopback (maybe other v4l1 devices too) (Peter Holik) http://www.lavrsen.dk/foswiki/bin/view/Motion/BugReport2009x06x17x090603 diff --git a/CREDITS b/CREDITS index a9dd9b1d..397af77e 100644 --- a/CREDITS +++ b/CREDITS @@ -416,6 +416,8 @@ Angel Carpintero * Avoid possible stack smashing in v4l_open_vidpipe(). * Allow compile with OpenSuse ffmpeg package (15594svn-20081010) http://www.lavrsen.dk/twiki/bin/view/Motion/SupportQuestion2008x10x25x070400 + * Avoid segfault detecting strerror_r() version GNU or SUSv3. + * Fix fd leaks in external pipe. Jared D * Change bayer2rgb24() to fix a problem with sn9c102 driver diff --git a/configure b/configure index 4a47c0d6..df0cff0e 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for motion trunk-r448. +# Generated by GNU Autoconf 2.61 for motion trunk-r449. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. @@ -572,8 +572,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='motion' PACKAGE_TARNAME='motion' -PACKAGE_VERSION='trunk-r448' -PACKAGE_STRING='motion trunk-r448' +PACKAGE_VERSION='trunk-r449' +PACKAGE_STRING='motion trunk-r449' PACKAGE_BUGREPORT='' ac_unique_file="motion.c" @@ -1177,7 +1177,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures motion trunk-r448 to adapt to many kinds of systems. +\`configure' configures motion trunk-r449 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1238,7 +1238,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of motion trunk-r448:";; + short | recursive ) echo "Configuration of motion trunk-r449:";; esac cat <<\_ACEOF @@ -1376,7 +1376,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -motion configure trunk-r448 +motion configure trunk-r449 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1390,7 +1390,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by motion $as_me trunk-r448, which was +It was created by motion $as_me trunk-r449, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -8230,7 +8230,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by motion $as_me trunk-r448, which was +This file was extended by motion $as_me trunk-r449, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -8279,7 +8279,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -motion config.status trunk-r448 +motion config.status trunk-r449 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/logger.c b/logger.c index 73c64695..e7fed34b 100644 --- a/logger.c +++ b/logger.c @@ -77,7 +77,7 @@ void motion_log(int level, int errno_flag, const char *fmt, ...) { int errno_save, n; char buf[1024]; -#if (!defined(BSD)) +#if (!defined(BSD)) && (!(_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE) char msg_buf[100]; #endif va_list ap; @@ -117,7 +117,9 @@ void motion_log(int level, int errno_flag, const char *fmt, ...) * my buffer :-(. I have put in a 'hack' to get around this. */ #if (defined(BSD)) - strerror_r(errno_save, buf + n, sizeof(buf) - n); /* 2 for the ': ' */ + strerror_r(errno_save, buf + n, sizeof(buf) - n); /* 2 for the ': ' */ +#elif (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE + strerror_r(errno_save, buf + n, sizeof(buf) - n); #else strncat(buf, strerror_r(errno_save, msg_buf, sizeof(msg_buf)), 1024 - strlen(buf)); #endif