selinux/libsepol/include/sepol
Nicolas Iooss 14c0564641 libsepol: fix most gcc -Wwrite-strings warnings
gcc puts literal strings lie in read-only memory.  On x86_64, trying to
write to them triggers a segmentation fault.

To detect such issues at build time, variables holding a pointer to such
strings should be "const char*".  "gcc -Wwrite-strings" warns when using
non-const pointers to literal strings.

Remove gcc warnings by adding const to local variables and argumens of
internal functions.

This does *not* fix this warning:

  policydb_public.c:208:10: warning: passing argument 2 of 'hashtab_search' discards 'const' qualifier from pointer target type
    return (hashtab_search(p->p.p_classes.table, PACKET_CLASS_NAME) ==
            ^
  In file included from ../include/sepol/policydb/symtab.h:16:0,
                   from ../include/sepol/policydb/policydb.h:60,
                   from policydb_public.c:4:
  ../include/sepol/policydb/hashtab.h:98:24: note: expected 'hashtab_key_t' but argument is of type 'const char *'
  extern hashtab_datum_t hashtab_search(hashtab_t h, const hashtab_key_t k);
                         ^

Moreover the "const" word in hashtab_search prototype does not make the
second parameter "const char*" but "char* const".

Acked-by: Steve Lawrence <slawrence@tresys.com>
2014-10-02 09:56:15 -04:00
..
policydb libsepol: fix most gcc -Wwrite-strings warnings 2014-10-02 09:56:15 -04:00
boolean_record.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
booleans.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
context_record.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
context.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
debug.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
errcodes.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
handle.h libsepol: libsemanage: policycoreutils: Create a new preserve_tunables flag in sepol_handle_t. 2011-09-16 11:54:02 -04:00
iface_record.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
interfaces.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
module.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
node_record.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
nodes.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
policydb.h libsepol: add function to libsepol for setting target_platform 2014-08-26 08:02:16 -04:00
port_record.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
ports.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
roles.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
sepol.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
user_record.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
users.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00