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

Re: Missing argument to ctime_r



FreeBSD3.0: /usr/include/time.h
	char *ctime_r __P((const time_t *, char *));

At 06:56 PM 12/28/98 +0100, Hallvard B Furuseth wrote:
>I need this patch to compile -devel on SGI and Solaris.  Was the code
>buggy, or was it written for a ctime_r which does not want the extra
>`buflen' argument?  If the latter, I expect configure must find the
>prototype.
>
>Hallvard
>
>
>Index: libraries/libldap/ldap-int.h
>===================================================================
>RCS file: /repo/OpenLDAP/pkg/ldap/libraries/libldap/ldap-int.h,v
>retrieving revision 1.20
>diff -u -2 -r1.20 ldap-int.h
>--- ldap-int.h	1998/12/23 01:30:44	1.20
>+++ ldap-int.h	1998/12/28 17:46:36
>@@ -375,5 +375,5 @@
> 
> extern char *ldap_int_strtok( char *str, const char *delim, char **pos );
>-extern char *ldap_int_ctime( const time_t *tp, char *buf );
>+extern char *ldap_int_ctime( const time_t *tp, char *buf, int buflen );
> extern int ldap_int_gethostbyname_a(
> 	const char *name, 
>Index: libraries/libldap/util-int.c
>===================================================================
>RCS file: /repo/OpenLDAP/pkg/ldap/libraries/libldap/util-int.c,v
>retrieving revision 1.1
>diff -u -2 -r1.1 util-int.c
>--- util-int.c	1998/12/19 00:27:21	1.1
>+++ util-int.c	1998/12/28 17:46:37
>@@ -36,8 +36,8 @@
> }
> 
>-char *ldap_int_ctime( const time_t *tp, char *buf )
>+char *ldap_int_ctime( const time_t *tp, char *buf, int buflen )
> {
> #ifdef HAVE_CTIME_R
>-	return ctime_r(tp,buf);
>+	return ctime_r(tp,buf,buflen);
> #else
> 	return ctime(tp);
>Index: libraries/libldap/request.c
>===================================================================
>RCS file: /repo/OpenLDAP/pkg/ldap/libraries/libldap/request.c,v
>retrieving revision 1.14
>diff -u -2 -r1.14 request.c
>--- request.c	1998/12/22 00:34:03	1.14
>+++ request.c	1998/12/28 17:46:36
>@@ -459,5 +459,6 @@
> 		    LDAP_CONNST_CONNECTING ) ? "Connecting" : "Connected" );
> 		fprintf( stderr, "  last used: %s\n",
>-		    ldap_int_ctime( &lc->lconn_lastused, timebuf ));
>+		    ldap_int_ctime( &lc->lconn_lastused,
>+				    timebuf, (int)sizeof( timebuf )));
> 		if ( !all ) {
> 			break;
>Index: libraries/libldap/tmplout.c
>===================================================================
>RCS file: /repo/OpenLDAP/pkg/ldap/libraries/libldap/tmplout.c,v
>retrieving revision 1.11
>diff -u -2 -r1.11 tmplout.c
>--- tmplout.c	1998/12/27 01:00:08	1.11
>+++ tmplout.c	1998/12/28 17:46:37
>@@ -902,5 +902,5 @@
>     gmttime = gtime( &t );
> 
>-    timestr = ldap_int_ctime( &gmttime, timebuf );
>+    timestr = ldap_int_ctime( &gmttime, timebuf, (int)sizeof( timebuf ) );
>    
>     timestr[ strlen( timestr ) - 1 ] = zone;	/* replace trailing newline */
>
>