/* To be used for verified unused parameters */
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
# define unused __attribute__((unused))
+# define format_attr(type, index, check) __attribute__((format (type, index, check)))
#else
# define unused
+# define format_attr(type, index, check)
#endif
/* ! Arguments evaluated twice ! */
/*
* Log callback for libselinux internal error reporting.
*/
-__attribute__((__format__ (printf, 2, 3)))
+format_attr(printf, 2, 3)
static int selinux_log_cb (int type, const char *fmt, ...) {
va_list ap;
char *buf;
#endif
+format_attr(printf, 3, 4)
static void semanage_error_callback (unused void *varg,
semanage_handle_t *handle,
const char *fmt, ...)
/*
* error_acl - format the error messages for the ACL and EQ libraries.
*/
-static void error_acl (struct error_context *ctx, const char *fmt, ...)
+format_attr(printf, 2, 3)
+static void error_acl (unused struct error_context *ctx, const char *fmt, ...)
{
va_list ap;
FILE *shadow_logfd = log_get_logfd();
{
struct tm *tp;
char buf[80];
- char format[80];
-
- if (iflg) {
- (void) snprintf (format, 80, "%%Y-%%m-%%d");
- }
- else {
- (void) snprintf (format, 80, "%%b %%d, %%Y");
- }
tp = gmtime (&date);
if (NULL == tp) {
(void) printf ("time_t: %lu\n", (unsigned long)date);
} else {
- (void) strftime (buf, sizeof buf, format, tp);
+ (void) strftime (buf, sizeof buf, iflg ? "%%Y-%%m-%%d" : "%%b %%d, %%Y", tp);
(void) puts (buf);
}
}