Portability: common-src/ammessage.c
[email protected] (Eric Schnoebelen)
| Newsgroups | gmane.comp.archivers.amanda.devel |
|---|---|
| Message-ID | <[email protected]> |
common-src/ammessage.c attempts to build an strerror() type interface (kinda), allocating an array of 500 elements, which are filled in with text versions of the errno values. The issue? gnulib's version of errno.h creates additional values in the 2000 range if the E* values it wants to use aren't already defined. And then ammessage.c tries to use the 2000+ valued errno values in an array of size 500.. Nice coredump at runtime! Fix: Verify that the errno values weren't defined by gnulib before attempting to use them to populate the array. patch both inline and as an attachment.. $NetBSD$ Make sure the E* macros aren't GNULIB macros, as those are defined in the 2000+ space. --- common-src/ammessage.c.orig 2016-11-23 16:11:16.000000000 +0000 +++ common-src/ammessage.c @@ -76,7 +76,7 @@ init_errcode(void) #ifdef EBADFD errcode[EBADFD] = "EBADFD"; #endif -#ifdef EBADMSG +#if defined(EBADMSG) && !defined(GNULIB_defined_EBADMSG) errcode[EBADMSG] = "EBADMSG"; #endif #ifdef EBADR @@ -91,7 +91,7 @@ init_errcode(void) #ifdef EBUSY errcode[EBUSY] = "EBUSY"; #endif -#ifdef ECANCELED +#if defined(ECANCELED) && !defined(GNULIB_defined_ECANCELED) errcode[ECANCELED] = "ECANCELED"; #endif #ifdef ECHILD @@ -103,7 +103,7 @@ init_errcode(void) #ifdef ECOMM errcode[ECOMM] = "ECOMM"; #endif -#ifdef ECONNABORTED +#if defined(ECONNABORTED) && !defined(GNULIB_defined_ECONABORTED) errcode[ECONNABORTED] = "ECONNABORTED"; #endif #ifdef ECONNREFUSED @@ -126,7 +126,7 @@ init_errcode(void) #ifdef EDOM errcode[EDOM] = "EDOM"; #endif -#ifdef EDQUOT +#if defined(EDQUOT) && !defined(GNULIB_defined_EDQUOT) errcode[EDQUOT] = "EDQUOT"; #endif #ifdef EEXIST @@ -147,7 +147,7 @@ init_errcode(void) #ifdef EIDRM errcode[EIDRM] = "EIDRM"; #endif -#ifdef EILSEQ +#if defined(EILSEQ) && !defined(GNULIB_defined_EILSEQ) errcode[EILSEQ] = "EILSEQ"; #endif #ifdef EINPROGRESS @@ -222,7 +222,7 @@ init_errcode(void) #ifdef EMSGSIZE errcode[EMSGSIZE] = "EMSGSIZE"; #endif -#ifdef EMULTIHOP +#if defined(EMULTIHOP) && !defined(GNULIB_defined_EMULTIHOP) errcode[EMULTIHOP] = "EMULTIHOP"; #endif #ifdef ENAMETOOLONG @@ -231,7 +231,7 @@ init_errcode(void) #ifdef ENETDOWN errcode[ENETDOWN] = "ENETDOWN"; #endif -#ifdef ENETRESET +#if defined(ENETRESET) && !defined(GNULIB_defined_ENETRESET) errcode[ENETRESET] = "ENETRESET"; #endif #ifdef ENETUNREACH @@ -261,7 +261,7 @@ init_errcode(void) #ifdef ENOLCK errcode[ENOLCK] = "ENOLCK"; #endif -#ifdef ENOLINK +#if defined(ENOLINK) && !defined(GNULIB_defined_ENOLINK) errcode[ENOLINK] = "ENOLINK"; #endif #ifdef ENOMEDIUM @@ -270,7 +270,7 @@ init_errcode(void) #ifdef ENOMEM errcode[ENOMEM] = "ENOMEM"; #endif -#ifdef ENOMSG +#if defined(ENOMSG) && !defined(GNULIB_defined_ENOMSG) errcode[ENOMSG] = "ENOMSG"; #endif #ifdef ENONET @@ -309,7 +309,7 @@ init_errcode(void) #ifdef ENOTSOCK errcode[ENOTSOCK] = "ENOTSOCK"; #endif -#ifdef ENOTSUP +#if defined(ENOTSUP) && !defined(GNULIB_defined_ENOTSUP) errcode[ENOTSUP] = "ENOTSUP"; #endif #ifdef ENOTTY @@ -324,7 +324,7 @@ init_errcode(void) #ifdef EOPNOTSUPP errcode[EOPNOTSUPP] = "EOPNOTSUPP"; #endif -#ifdef EOVERFLOW +#if defined(EOVERFLOW) && !defined(GNULIB_defined_EOVERFLOW) errcode[EOVERFLOW] = "EOVERFLOW"; #endif #ifdef EPERM @@ -336,7 +336,7 @@ init_errcode(void) #ifdef EPIPE errcode[EPIPE] = "EPIPE"; #endif -#ifdef EPROTO +#if defined(EPROTO) && !defined(GNULIB_defined_EPROTO) errcode[EPROTO] = "EPROTO"; #endif #ifdef EPROTONOSUPPORT @@ -375,7 +375,7 @@ init_errcode(void) #ifdef ESRCH errcode[ESRCH] = "ESRCH"; #endif -#ifdef ESTALE +#if defined(ESTALE) && !defined(GNULIB_defined_ESTALE) errcode[ESTALE] = "ESTALE"; #endif #ifdef ESTRPIPE @@ -408,10 +408,10 @@ init_errcode(void) #ifdef EXFULL errcode[EXFULL] = "EXFULL"; #endif -#ifdef EOWNERDEAD +#if defined(EOWNERDEAD) && !defined(GNULIB_defined_EOWNERDEAD) errcode[EOWNERDEAD] = "EOWNERDEAD"; #endif -#ifdef ENOTRECOVERABLE +#if defined(ENOTRECOVERABLE) && !defined(GNULIB_defined_ENOTRECOVERABLE) errcode[ENOTRECOVERABLE] = "ENOTRECOVERABLE"; #endif #ifdef ERFKILL
common-src_ammessage.c.patch
(text/plain, 3.5 KB)
$NetBSD$ Make sure the E* macros aren't GNULIB macros, as those are defined in the 2000+ space. --- common-src/ammessage.c.orig 2016-11-23 16:11:16.000000000 +0000 +++ common-src/ammessage.c @@ -76,7 +76,7 @@ init_errcode(void) #ifdef EBADFD errcode[EBADFD] = "EBADFD"; #endif -#ifdef EBADMSG +#if defined(EBADMSG) && !defined(GNULIB_defined_EBADMSG) errcode[EBADMSG] = "EBADMSG"; #endif #ifdef EBADR @@ -91,7 +91,7 @@ init_errcode(void) #ifdef EBUSY errcode[EBUSY] = "EBUSY"; #endif -#ifdef ECANCELED +#if defined(ECANCELED) && !defined(GNULIB_defined_ECANCELED) errcode[ECANCELED] = "ECANCELED"; #endif #ifdef ECHILD @@ -103,7 +103,7 @@ init_errcode(void) #ifdef ECOMM errcode[ECOMM] = "ECOMM"; #endif -#ifdef ECONNABORTED +#if defined(ECONNABORTED) && !defined(GNULIB_defined_ECONABORTED) errcode[ECONNABORTED] = "ECONNABORTED"; #endif #ifdef ECONNREFUSED @@ -126,7 +126,7 @@ init_errcode(void) #ifdef EDOM errcode[EDOM] = "EDOM"; #endif -#ifdef EDQUOT +#if defined(EDQUOT) && !defined(GNULIB_defined_EDQUOT) errcode[EDQUOT] = "EDQUOT"; #endif #ifdef EEXIST @@ -147,7 +147,7 @@ init_errcode(void) #ifdef EIDRM errcode[EIDRM] = "EIDRM"; #endif -#ifdef EILSEQ +#if defined(EILSEQ) && !defined(GNULIB_defined_EILSEQ) errcode[EILSEQ] = "EILSEQ"; #endif #ifdef EINPROGRESS @@ -222,7 +222,7 @@ init_errcode(void) #ifdef EMSGSIZE errcode[EMSGSIZE] = "EMSGSIZE"; #endif -#ifdef EMULTIHOP +#if defined(EMULTIHOP) && !defined(GNULIB_defined_EMULTIHOP) errcode[EMULTIHOP] = "EMULTIHOP"; #endif #ifdef ENAMETOOLONG @@ -231,7 +231,7 @@ init_errcode(void) #ifdef ENETDOWN errcode[ENETDOWN] = "ENETDOWN"; #endif -#ifdef ENETRESET +#if defined(ENETRESET) && !defined(GNULIB_defined_ENETRESET) errcode[ENETRESET] = "ENETRESET"; #endif #ifdef ENETUNREACH @@ -261,7 +261,7 @@ init_errcode(void) #ifdef ENOLCK errcode[ENOLCK] = "ENOLCK"; #endif -#ifdef ENOLINK +#if defined(ENOLINK) && !defined(GNULIB_defined_ENOLINK) errcode[ENOLINK] = "ENOLINK"; #endif #ifdef ENOMEDIUM @@ -270,7 +270,7 @@ init_errcode(void) #ifdef ENOMEM errcode[ENOMEM] = "ENOMEM"; #endif -#ifdef ENOMSG +#if defined(ENOMSG) && !defined(GNULIB_defined_ENOMSG) errcode[ENOMSG] = "ENOMSG"; #endif #ifdef ENONET @@ -309,7 +309,7 @@ init_errcode(void) #ifdef ENOTSOCK errcode[ENOTSOCK] = "ENOTSOCK"; #endif -#ifdef ENOTSUP +#if defined(ENOTSUP) && !defined(GNULIB_defined_ENOTSUP) errcode[ENOTSUP] = "ENOTSUP"; #endif #ifdef ENOTTY @@ -324,7 +324,7 @@ init_errcode(void) #ifdef EOPNOTSUPP errcode[EOPNOTSUPP] = "EOPNOTSUPP"; #endif -#ifdef EOVERFLOW +#if defined(EOVERFLOW) && !defined(GNULIB_defined_EOVERFLOW) errcode[EOVERFLOW] = "EOVERFLOW"; #endif #ifdef EPERM @@ -336,7 +336,7 @@ init_errcode(void) #ifdef EPIPE errcode[EPIPE] = "EPIPE"; #endif -#ifdef EPROTO +#if defined(EPROTO) && !defined(GNULIB_defined_EPROTO) errcode[EPROTO] = "EPROTO"; #endif #ifdef EPROTONOSUPPORT @@ -375,7 +375,7 @@ init_errcode(void) #ifdef ESRCH errcode[ESRCH] = "ESRCH"; #endif -#ifdef ESTALE +#if defined(ESTALE) && !defined(GNULIB_defined_ESTALE) errcode[ESTALE] = "ESTALE"; #endif #ifdef ESTRPIPE @@ -408,10 +408,10 @@ init_errcode(void) #ifdef EXFULL errcode[EXFULL] = "EXFULL"; #endif -#ifdef EOWNERDEAD +#if defined(EOWNERDEAD) && !defined(GNULIB_defined_EOWNERDEAD) errcode[EOWNERDEAD] = "EOWNERDEAD"; #endif -#ifdef ENOTRECOVERABLE +#if defined(ENOTRECOVERABLE) && !defined(GNULIB_defined_ENOTRECOVERABLE) errcode[ENOTRECOVERABLE] = "ENOTRECOVERABLE"; #endif #ifdef ERFKILL