[collectd] [PATCH] Added the AC_FUNC_STRERROR_R check.

Philipp Giebel newsletter at amb-net.de
Mon Sep 3 12:31:54 CEST 2007


Sebastian Harl schrieb:
> However, if you did not get that warning before, your configure script has not
> been updated. Something really seems to be screwed here. Can you please tell
> us how you applied the patch (as I asked before).

~/dev/collectd-4.1.0# cat error.patch |patch -p1

patching file configure.in
patching file src/common.c



~/dev/collectd-4.1.0# cat error.patch

--- a/configure.in
+++ b/configure.in
@@ -365,6 +365,8 @@ AC_HEADER_TIME
 AC_PROG_GCC_TRADITIONAL
 AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo
getnameinfo strchr memcpy strstr strcmp strncmp strncpy strlen
strncasecmp strcasecmp openlog closelog)

+AC_FUNC_STRERROR_R
+
 AC_CHECK_FUNCS(getpwnam_r)
 AC_CHECK_FUNCS(getgrnam_r)

--- a/src/common.c
+++ b/src/common.c
@@ -70,12 +70,17 @@ char *sstrdup (const char *s)
        return (r);
 }

-/* Don't use the return value of `strerror_r', because the GNU-people got
- * inventive there.. -octo */
+/* Even though Posix requires "strerror_r" to return an "int",
+ * some systems (e.g. the GNU libc) return a "char *" _and_
+ * ignore the second argument ... -tokkee */
 char *sstrerror (int errnum, char *buf, size_t buflen)
 {
        buf[0] = '\0';
+#ifdef STRERROR_R_CHAR_P
+       buf = strerror_r (errnum, buf, buflen);
+#else
        strerror_r (errnum, buf, buflen);
+#endif /* STRERROR_R_CHAR_P */
        return (buf);
 } /* char *sstrerror */

---------------------------

The point is: I did it that way all the time.. With all these different
results, I've posted here.. I'ld bet the problem is me doing something
completely stupid, but I have no idea what.. ;)

> Maybe it's best you just checkout the repository:
> 
> If you trouble compiling it, please don't hesitate to ask, but please provide
> detailed information what you did and what kind of error messages you got.

Okay, I did so and I have a problem (of course.. ;) ):

  make[4]: Entering directory \
    `/root/dev/collectd/collectd-git/collectd/src/liboconfig'
  /bin/sh ../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H \
    -I. -I. -I../../src     -g -O2 -c -o oconfig.lo oconfig.c
  mkdir .libs
  gcc -DHAVE_CONFIG_H -I. -I. -I../../src -g -O2 -c oconfig.c  -fPIC \
    -DPIC -o .libs/oconfig.o
  :   scanner.l
  sed '/^#/ s|\.c|scanner.c|' .c >scanner.c
  sed: can't read .c: No such file or directory

But why do I have to use the git? 4.1.0 + patch + version-gen.sh +
build.sh did the job, the error-messages are being written to syslog so
everything is fine but changing the group.. (My original problem..)

> Exactly, that's what you should try to avoid, please.
Gnn.. I'ld better read the whole thing.. ;/ Changed that, now..

Cheers,
  Philipp



More information about the collectd mailing list