mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-31 06:16:03 +00:00
parser: fix i386 breakage on min() argument mismatches
Trunk commit 2456 broke the builds on i386 with the following compiler error: g++ -g -O2 -pipe -Wall -Wsign-compare -Wmissing-field-initializers -Wformat-security -Wunused-parameter -std=gnu++0x -D_GNU_SOURCE -DPACKAGE=\"apparmor-parser\" -DLOCALEDIR=\"/usr/share/locale\" -DSUBDOMAIN_CONFDIR=\"/etc/apparmor\" -I../libraries/libapparmor//include -c -o lib.o lib.c lib.c: In function 'int strn_escseq(const char**, const char*, size_t)': lib.c:236:47: error: no matching function for call to 'min(long unsigned int, size_t&)' tmp = strntol(*pos, &end, 8, 255, min(3ul, n)); ^ This is due to size_t differing in size on i386 and amd64. The following patch addresses the issue by casting the constant values to size_t (and removing the ul suffix since the constant values are getting cast anyway), satisfying C++'s types (and the patch removes the unnecessary min macro). Signed-off-by: Steve Beattie <steve@nxnw.org> Acked-by: John Johansen <john.johansen@canonical.com> Acked-by: Seth Arnold <seth.arnold@canonical.com>
This commit is contained in:
@@ -3,11 +3,6 @@
|
||||
|
||||
#include <dirent.h>
|
||||
|
||||
#define min(a,b) \
|
||||
({ __typeof__ (a) _a = (a); \
|
||||
__typeof__ (b) _b = (b); \
|
||||
_a < _b ? _a : _b; })
|
||||
|
||||
int dirat_for_each(DIR *dir, const char *name, void *data,
|
||||
int (* cb)(DIR *, const char *, struct stat *, void *));
|
||||
|
||||
|
Reference in New Issue
Block a user