summaryrefslogtreecommitdiff
path: root/lib/compat
AgeCommit message (Collapse)AuthorFilesLines
2017-02-26libcompat: Do not redeclare sys_siglist when the system does soThomas Klausner1-1/+0
This can cause issues if the declaration is not exactly the same, and declaring it when the system already does is bogus no matter what. Signed-off-by: Guillem Jover <guillem@debian.org>
2016-10-30libcompat: Disable gettext support in getopt moduleGuillem Jover1-8/+3
We do not carry translations for this module, and it makes it pull libintl for programs that might not use it otherwise.
2016-10-30libcompat: Include getopt module when we need getopt_longGuillem Jover1-0/+4
The latter requires the local getopt implementation, so we need to include it even if the system provides a getopt implementation.
2016-10-30libcompat: Add missing <errno.h> includeGuillem Jover1-0/+1
Warned-by: gcc on AIX
2016-07-03build: Uniformize library build optionsGuillem Jover1-2/+2
Make all of them consistently follow the pattern --with-lib<name>. Rename the m4 macros, preprocessor defines, and automake _LIBS flags.
2015-10-18Update Ian Jackson's email addressGuillem Jover8-8/+8
2015-07-30libcompat: Use string_to_security_class() instead of literal SECCLASS valuesGuillem Jover1-2/+6
The <selinux/flask.h> header is deprecated, and warns to use string_to_security_class() instead of macro values.
2015-07-30libcompat: Try to use NSIG when sys_siglist is definedGuillem Jover1-1/+6
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@gmail.com>
2015-05-30build: Use system libmd if availableGuillem Jover1-1/+2
This fixes a build failure on at least FreeBSD, and possibly other BSD systems, where the md5.h header provided by libmd maps the md5 functions to namespaced ones, and then there is a mismatch between the always included functions from libcompat and from libmd.
2015-04-01libcompat: Check that HAVE_DECL_SYS_SIGLIST is 0 instead of undefinedGuillem Jover1-1/+1
Cherry picked from commit 4e872b317ef6d69d3daab1058ddfa7a8940a06a6. For declarations the autoconf test always defines the preprocessor symbol to either 0 or 1, contrary to other tests where it's either undefined or 1. Closes: #777044 Based-on-patch-by: Alex Potapenko <opotapenko@gmail.com>
2015-01-28libcompat: Remove dangling blank lineGuillem Jover1-1/+0
2014-08-19libcompat: Only test the strerror() if sys_errlist and sys_nerr are presentGuillem Jover2-2/+7
These are deprecated symbols, and some systems which do have strerror() do not have these variables, most notably GNU/Hurd. So do not try to test the current implementation there as it will fail. Closes: #758199
2014-08-15libcompat: Only build the compatibility selinux code if requestedGuillem Jover1-1/+6
If we are not using libselinux, then we cannot build the selinux compatibility code as it requires the library. Also fixes build failures on non-Linux systems, where the library is not available. Closes: #757637
2014-08-09libcompat: Add a setexecfilecon() function out from dpkg codeGuillem Jover3-0/+90
This is now a fallback implementation in case libselinux is too old.
2014-08-09libcompat: Do not run qsort over the scandir list if it is NULLGuillem Jover1-1/+1
Warned-by: coverity
2014-08-09libcompat: Mark compat functions with attribute printf and vprintfGuillem Jover1-4/+16
We duplicate these macros here too so that we can quiesce some warnings when building the compatibility code.
2014-08-09libdpkg: Move __func__ and nullptr definitions to libcompatGuillem Jover1-0/+21
These are really compatibility macros for systems w/o the required compiler support. We need to duplicate the logic for LIBCOMPAT_GCC_VERSION, but for now we will keep that and DPKG_GCC_VERSION to avoid having to make compat.h a public header.
2014-08-09libcompat: Make the library testableGuillem Jover12-22/+86
This will allow us to guarantee the compatibility implementations at least build, and can eventually be tested.
2014-05-17build: Switch to use libtool for the static librariesGuillem Jover1-15/+15
This makes it possible to embed libcompat inside libdpkg, so that the static library that we ship is self contained with the required compatibility code, specifically the MD5 functions. This also prepares the build system for when we start building a shared library, although it disables it by default. Closes: #746122
2014-04-30libcompat: Make sure P_tmpdir is always definedGuillem Jover1-0/+4
This will guarantee the macro constant is always defined, which allows us to remove an equivalent code branch, which in normal conditions is dead code. As a side effect this unconfuses static code analyzers like cppcheck or coverity.
2014-04-27libcompat: Fix comparison between signed and unsigned in strsignal()Guillem Jover1-1/+1
2014-04-27libcompat: Declare strnlen() prototype in compat.hGuillem Jover4-36/+6
Remove now unused strnlen.h header.
2014-01-15libcompat: Add new makedev(3) fallback functionGuillem Jover1-0/+4
2013-12-07Use https:// URLs instead of http:// when possibleGuillem Jover11-11/+11
2013-10-27libcompat: Do not NULL-terminate the list in scandir()Guillem Jover1-1/+0
This might cause a segfault in case all entries have been filtered and list has not been allocated. This should only possibly affect systems where the fallback code is being used.
2013-07-18libcompat: Take over md5 module from libdpkgGuillem Jover3-0/+289
The md5 code is imported from the BSDs, and should not generally be touched, only updated from there. Also on several platforms the code should use the system available interfaces instead.
2013-04-04Fix spelling errorsGuillem Jover1-1/+1
The other spelling errors come from external projects (doxygen and pkg-config), which are being dealt upstream. Warned-by: codespell
2012-06-30libcompat: Add a dummy symbol to the empty moduleGuillem Jover1-0/+1
This avoids warnings on systems that do not like a completely empty object file, or an empty output after the preprocessor has run.
2012-06-06libcompat: Add compat symbol for O_NOFOLLOWGuillem Jover1-0/+4
This symbol was only standardized in POSIX.1-2008, which is too recent. Although it has been available on at least FreeBSD and Linux systems before that, but dpkg supports other systems which might not have it.
2012-05-23libcompat: Remove compat definition for strtoul()Guillem Jover1-4/+0
Using this function is unsafe, because there's no way to know if the input contained a negative number. Remove the compat definition now that we do not use this function any longer.
2012-01-16Fix typos (children)Guillem Jover1-1/+1
Found by Lintian.
2012-01-11libcompat: Use a different temporary file per process on vsnprintf()Guillem Jover1-1/+11
Avoid race conditions from childs after fork(2). Closes: #655411 Reported-by: Daniel Ruoso <daniel@ruoso.com>
2011-12-13libcompat: Add missing ‘*’ in asprintf() and vasprintf() declarationsGuillem Jover1-2/+2
2011-12-13libcompat: Do not ifdef out compatibility code definitionsGuillem Jover10-20/+0
The code is already selected (or not) to be included by the Makefile machinery, there's no need to disabled it too in the actual code, and not doing so will allow to test it later on.
2011-11-12libcompat: Add new strndup()Guillem Jover3-0/+56
2011-09-29libcompat: Only include libintl.h on --disable-nls if using glibc >= 2Guillem Jover1-1/+1
On some systems like MacOS X, gettext's libintl.h redefines setlocale() to a replacement function from libintl, which will make the build fail if we end up including the header but not linking to libintl. This could happen when using --disable-nls to build C++ code and having the libintl.h header present with the setlocale() replacement function, but that header is only supposed to be included if building C++ code on a glibc system. Restore the logic before commit 8f8e9d9af75672ae051c2d3c11dd797b666b87b8, but explicitly check that we are not building on a uclibc system.
2011-09-26libcompat: Update obstack module from gnulibGuillem Jover2-518/+255
The version taken is the one before the switch to GPLv3+. With a slight code revert to not have to include exitfail.c and exitfail.h. This fixes --disable-nls on systems where obstack support is missing, by using the local "gettext.h" which honours ENABLE_NLS, instead of just directly using <libintl.h>. This also fixes code warnings due to obsolete K&R style prototypes, and removes the need for bcopy checks.
2011-02-06libcompat: Add missing semicolon to vsnprintf() declarationRobert Millan1-1/+1
This makes the build fail on systems where vsnprintf() is missing or not compliant enough, and thus the fallback is being used. Closes: #612203 Signed-off-by: Guillem Jover <guillem@debian.org>
2011-02-03libcompat: Define gettext context functions when NLS is disabledGuillem Jover1-0/+32
When the package is configured with NLS disabled (--disable-nls), the build will fail due to undefined references to LC_MESSAGES, the gettext.h header file does not correctly handle the gettext context related function declarations on disabled NLS support, which is known to be used by downstreams. This adds all missing macros corresponding to their NLS enabled counterparts.
2010-11-19Cleanup white spacesGuillem Jover9-9/+0
Remove trailing spaces. Remove blank lines not separating different code blocks. Remove blank lines at the end of the file.
2010-07-29libcompat: On successful realloc assign the newlist to listGuillem Jover1-0/+1
2010-06-07Unify naming of va_list variables to args or args_copyGuillem Jover2-6/+6
2010-06-07libcompat: Add declarations in compat.h for snprintf functionsGuillem Jover1-0/+8
2010-06-07libcompat: Add support for asprintf and vasprintfGuillem Jover4-0/+108
Provide compatibility code whenever the system does not.
2010-06-01build: Do not fallback to use chown instead of lchown if not availableGuillem Jover1-4/+0
When creating symlinks on extraction, dpkg needs to set its owner, if we fallback to use chown in place of lchown we might get to a situation where the dereferenced symlink does not yet exist, which would cause an unwanted error. On some older and buggy systems, chown does not actually dereference symlinks, so it could be safely used although it would need to be detected at runtime, as the kernel could be switched under our feet, but given that lchown is already specified by UNIX98, there's not much sense in not assuming it's present and working at this point in time.
2010-02-25libcompat: Update gettext.h from gettext 0.17Guillem Jover1-10/+16
This changes its license from LGPL2+ to GPL2+.
2009-12-31libcompat: Define lchown as chown if the former is not availableGuillem Jover1-0/+4
Instead of duplicating the code with chown calls when lchown is not available, just map it with a macros.
2009-11-09libcompat: Do not preallocate list before the loop in scandirGuillem Jover1-7/+6
Let the realloc in the loop take care of it once it's needed, this way we get rid of an additional point of failure.
2009-11-09libcompat: Fix resource leaks on error conditions in scandirGuillem Jover1-15/+39
2009-11-08Unify text in license headersGuillem Jover8-40/+40
Add a missing “of the License” after “version 2”. Move “but” and “GNU” at the end of line to the next line. This matches more closely the paragraph found in the license text for the GPL version 2.