Example #1
0
void
VAuditF(const char *f, va_list args)
{
    char *prefix;
    char buf[1024];
    int len;
    static char oldbuf[1024];

    prefix = AuditPrefix();
    len = vsnprintf(buf, sizeof(buf), f, args);

    if (len == oldlen && strcmp(buf, oldbuf) == 0) {
	/* Message already seen */
	nrepeat++;
    } else {
	/* new message */
	if (auditTimer != NULL)
	    TimerForce(auditTimer);
	ErrorF("%s%s", prefix != NULL ? prefix : "", buf);
	strlcpy(oldbuf, buf, sizeof(oldbuf));
	oldlen = len;
	nrepeat = 0;
	auditTimer = TimerSet(auditTimer, 0, AUDIT_TIMEOUT, AuditFlush, NULL);
    }
    free(prefix);
}
Example #2
0
void
VAuditF(const char *f, va_list args)
{
    char *prefix;
    char buf[1024];

    prefix = AuditPrefix();
    vsnprintf(buf, sizeof(buf), f, args);

    /* XXX Compressing duplicated messages is temporarily disabled to
     * work around bugzilla 964:
     *     https://freedesktop.org/bugzilla/show_bug.cgi?id=964
     */
    ErrorF("%s%s", prefix != NULL ? prefix : "", buf);

    if (prefix != NULL)
	free(prefix);
}
Example #3
0
static CARD32
AuditFlush(OsTimerPtr timer, CARD32 now, pointer arg)
{
    char *prefix;

    if (nrepeat > 0) {
	prefix = AuditPrefix();
	ErrorF("%slast message repeated %d times\n",
	       prefix != NULL ? prefix : "", nrepeat);
	nrepeat = 0;
	free(prefix);
	return AUDIT_TIMEOUT;
    } else {
	/* if the timer expires without anything to print, flush the message */
	oldlen = -1;
	return 0;
    }
}
Example #4
0
void
VAuditF(const char *f, va_list args)
{
    char *prefix;
    char buf[1024];
    int len;
    static char oldbuf[1024];

    prefix = AuditPrefix();
    len = vsnprintf(buf, sizeof(buf), f, args);

#if 1
    /* XXX Compressing duplicated messages is temporarily disabled to
     * work around bugzilla 964:
     *     https://freedesktop.org/bugzilla/show_bug.cgi?id=964
     */
    ErrorF("%s%s", prefix != NULL ? prefix : "", buf);
    oldlen = -1;
    nrepeat = 0;
#else
    if (len == oldlen && strcmp(buf, oldbuf) == 0) {
	/* Message already seen */
	nrepeat++;
    } else {
	/* new message */
	if (auditTimer != NULL)
	    TimerForce(auditTimer);
	ErrorF("%s%s", prefix != NULL ? prefix : "", buf);
	strlcpy(oldbuf, buf, sizeof(oldbuf));
	oldlen = len;
	nrepeat = 0;
	auditTimer = TimerSet(auditTimer, 0, AUDIT_TIMEOUT, AuditFlush, NULL);
    }
#endif
    if (prefix != NULL)
	free(prefix);
}