[Reproducible-commits] [dpkg] 48/90: libcompat: Try to use NSIG when sys_siglist is defined
Jérémy Bobbio
lunar at moszumanska.debian.org
Sat Aug 29 18:26:14 UTC 2015
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch pu/reproducible_builds
in repository dpkg.
commit 02eabc99813dcee64ee5016f1e878c408b639328
Author: Guillem Jover <guillem at debian.org>
Date: Wed Jul 29 19:19:18 2015 +0200
libcompat: Try to use NSIG when sys_siglist is defined
We cannot compute the size of the array with sizeof when the only thing
we have is an extern declaration. Try to use NSIG, and fallback to 32
items in case it is not defined.
Prompted-by: Igor Pashev <pashev.igor at gmail.com>
---
debian/changelog | 3 +++
lib/compat/strsignal.c | 7 ++++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/debian/changelog b/debian/changelog
index fb193c9..420d947 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,9 @@ dpkg (1.18.2) UNRELEASED; urgency=low
* Add support for ignoring built-in build dependencies and conflicts
with the new «dpkg-buildpackage --ignore-builtin-builddeps» and
«dpkg-checkbuilddeps -I» options. Closes: #480638, #571671
+ * When sys_siglist is defined in the system, try to use NSIG as we cannot
+ compute the array size with sizeof(). If NSIG is missing fallback to 32
+ items. Prompted by Igor Pashev <pashev.igor at gmail.com>.
* Perl modules:
- Remove non-functional timezone name support from
Dpkg::Changelog::Entry::Debian.
diff --git a/lib/compat/strsignal.c b/lib/compat/strsignal.c
index 265feb4..a5d6d53 100644
--- a/lib/compat/strsignal.c
+++ b/lib/compat/strsignal.c
@@ -54,7 +54,12 @@ const char *const sys_siglist[] = {
"SIGTTIN", /* 21 */
"SIGTTOU", /* 22 */
};
+# define COMPAT_NSIGLIST (int)(sizeof(sys_siglist) / sizeof(sys_siglist[0]))
#else
+# ifndef NSIG
+# define NSIG 32
+# endif
+# define COMPAT_NSIGLIST NSIG
extern const char *const sys_siglist[];
#endif
@@ -63,7 +68,7 @@ strsignal(int s)
{
static char buf[100];
- if (s > 0 && s < (int)(sizeof(sys_siglist) / sizeof(sys_siglist[0])))
+ if (s > 0 && s < COMPAT_NSIGLIST)
return sys_siglist[s];
sprintf(buf, _("Unknown signal %d"), s);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git
More information about the Reproducible-commits
mailing list