libselinux: Add printf format attribute annotation to die() method

Annotating the die method as taking printf format exposes
a bug in error reporting

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel P. Berrange 2012-01-23 15:41:18 +00:00 committed by Eric Paris
parent 57928fa1fd
commit 91d9fe8af0

View File

@ -43,7 +43,7 @@ static char buf[DEF_BUF_SIZE];
/* selinuxfs mount point */
extern char *selinux_mnt;
static void die(const char *msg, ...)
static __attribute__((__format__(printf,1,2))) void die(const char *msg, ...)
{
va_list args;
@ -118,7 +118,7 @@ int main(int argc, char **argv)
exit(0);
default:
usage();
die("unrecognized parameter", i);
die("unrecognized parameter '%c'", i);
}
}