[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#5441) Avoid unneccessary time() syscall in auditlog overlay



Full_Name: Rein Tollevik
Version: CVS head
OS: linux and solaris
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (81.93.160.250)


Below is a minor enhancement to the auditlog overlay, don't fetch the time()
until it is known that it is needed.  Which it isn't on all those search
responses that passes through it..

Rein Tollevik
Basefarm AS

Index: OpenLDAP/servers/slapd/overlays/auditlog.c
diff -u OpenLDAP/servers/slapd/overlays/auditlog.c:1.1.1.8
OpenLDAP/servers/slapd/overlays/auditlog.c:1.2
--- OpenLDAP/servers/slapd/overlays/auditlog.c:1.1.1.8	Sat Mar 22 16:48:17 2008
+++ OpenLDAP/servers/slapd/overlays/auditlog.c	Wed Mar 26 22:58:55 2008
@@ -74,7 +74,7 @@
 	Modifications *m;
 	struct berval *b, *who = NULL;
 	char *what, *suffix;
-	long stamp = slap_get_time();
+	time_t stamp;
 	int i;
 
 	if ( rs->sr_err != LDAP_SUCCESS ) return SLAP_CB_CONTINUE;
@@ -125,6 +125,7 @@
 		return SLAP_CB_CONTINUE;
 	}
 
+	stamp = slap_get_time();
 	fprintf(f, "# %s %ld %s%s%s\n",
 		what, stamp, suffix, who ? " " : "", who ? who->bv_val : "");