apparmor/parser/lib.h
Steve Beattie e4cc8d1396 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>
2014-04-17 09:20:40 -07:00

15 lines
439 B
C

#ifndef __AA_LIB_H_
#define __AA_LIB_H_
#include <dirent.h>
int dirat_for_each(DIR *dir, const char *name, void *data,
int (* cb)(DIR *, const char *, struct stat *, void *));
bool isodigit(char c);
long strntol(const char *str, const char **endptr, int base, long maxval,
size_t n);
int strn_escseq(const char **pos, const char *chrs, size_t n);
int str_escseq(const char **pos, const char *chrs);
#endif /* __AA_LIB_H_ */