Can someone tell me what I'm doing wrong?

Kenichi Okuyama okuyamak at
Wed May 23 02:36:52 GMT 2001

Dear Ray-san,

I don't know if this is the point. But this is what I found first.

>>>>> "RVD" == Ray Van Dolson <rayvd at> writes:
RVD>   strncpy(workgroup,WORKGROUP,8);

According to my ANSI-C dictionary, strncpy will do the following.

1) strlen( "STUDENTS" ) returns 8, so total buffer size required to
   copy "STUDENTS" to workgroup is *9*.

2) if given 3rd parameter which is allowed-copy-length is less then
   source string length +1 ( +1 for termination ),
   strncpy will make workgroup as follow:

   { 'S', 'T', 'U', 'D', 'E', 'N', 'T', 'S' }

   the key point is that we don't have '\0'.

Maybe this is the point ( or something similar is ).
Kenichi Okuyama

More information about the samba-technical mailing list