broken strndup on AIX 5.1

Simo Sorce idra at samba.org
Mon Aug 23 21:29:02 GMT 2004


On Mon, 2004-08-23 at 23:20, William Jojo wrote:
> If I can help here. I do not have the gcc used, but I ran these test
> programs using the IBM compiler on 5.2 and the listed filesets described
> below. It appears that strndup is fine, but strnlen returns questionable
> results.

Yeah I just reproduced the same result on a 5.1 AIX box.

strndup works fine, but strnlen give this result:

strnlen.c
-----------------------------------------------
#include <stdio.h>
#include <string.h>

int main(void)
{
  char *test = "1234567890";
  int i;
  for (i=0;i<9;i++) {
    printf("%d\n", strnlen(test,i));
  }
  return 0;
}
-----------------------------------------------
./strnlen
0
3
2
1
0
7
6
5
4

Do anyone here have access to an AIX 4.3.3 box and check strndup is ok
and strnlen broken here too?

Simo.

-- 
Simo Sorce    -  idra at samba.org
Samba Team    -  http://www.samba.org
Italian Site  -  http://samba.xsec.it



More information about the samba-technical mailing list