Bug 3796 - strnlen function prototype not included correctly
Summary: strnlen function prototype not included correctly
Status: RESOLVED WORKSFORME
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: nmbd (show other bugs)
Version: 3.0.22
Hardware: All All
: P3 normal
Target Milestone: none
Assignee: Samba Bugzilla Account
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-22 20:23 UTC by Peter Maguire (dead mail address)
Modified: 2022-03-06 23:41 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Maguire (dead mail address) 2006-05-22 20:23:23 UTC
strnlen function prototype not included correctly

in includes.h

change #ifndef HAVE_STRNLEN

to #if !defined(HAVE_STRNLEN) || defined(BROKEN_STRNLEN)

ENV
AIX 4.3
gcc 3.4.3
Comment 1 William Jojo 2006-05-23 15:30:54 UTC
Peter,

Is strnlen not defined in /usr/include/string.h for 4.3? That's the only time this should matter. Are you receiveing a specific build error for this?

Bill
Comment 2 Peter Maguire (dead mail address) 2006-05-23 22:32:01 UTC
Yes, a incompatible declaration for strnlen error on compile of util_str.c, line 1665 as below and

#if !defined(HAVE_STRNLEN) || defined(BROKEN_STRNLEN)
/**
 Some platforms don't have strnlen
**/

/*line 1665 */ size_t strnlen(const char *s, size_t n) {
	size_t i;
	for (i=0; i<n && s[i] != '\0'; i++)
		/* noop */ ;
	return i;
}
#endif


And line 598


	if (!src) {
		*dest = 0;
		return dest;
	}  

/* line 598 */	len = strnlen(src, maxlength+1);


change to includes.h fixed

(In reply to comment #0)
> strnlen function prototype not included correctly
> 
> in includes.h
> 
> change #ifndef HAVE_STRNLEN
> 
> to #if !defined(HAVE_STRNLEN) || defined(BROKEN_STRNLEN)
> 
> ENV
> AIX 4.3
> gcc 3.4.3
> 

Comment 3 Björn Jacke 2022-03-06 23:41:47 UTC
I don't see a problem with this in current versions