On Fri, Aug 15, 2008 at 12:28 AM, Huie-Ying Lee <[EMAIL PROTECTED]> wrote:
> Hello,
Hello,
> The "strndup()" function is a Gnu extension which is not supported on
> Solaris OS or standard C library.
> To resolve a related compilation error, we made a small change to the
> src/tools/pkcs11_setup.c file for the Solaris port.
> Please accept the change, so that it will be more portable for the future
> releases.
>
> Attached is the patch file. Let me know if you have any comments.
>
> Thanks,
> Huie-Ying
>
> Index: src/tools/pkcs11_setup.c
> ===================================================================
> --- src/tools/pkcs11_setup.c (revision 325)
> +++ src/tools/pkcs11_setup.c (working copy)
> @@ -69,7 +69,8 @@
>
> while (value != NULL) {
> if ((next=strchr(value, ',')) != NULL) {
> - lstitem = strndup(value, next-value);
> + lstitem = strdup(value);
> + lstitem[next-value]='\0';
> next++;
> }
> else {
You changed the semantic (a bit) because you assume value is a
NUL-terminated string when you use strdup(value);
I would prefer to add an implementation of strndup() on platform without it.
I found many free implementation like the one from tar [1].
Bye
[1]
http://www.google.fr/codesearch?hl=fr&q=show:qpSs4ioSpog:LamQPxhK_CA:qSDv38YtxWw&sa=N&ct=rd&cs_p=http://ftp.gnu.org/gnu/tar/tar-1.16.tar.bz2&cs_f=tar-1.16/lib/strndup.c&start=1
--
Dr. Ludovic Rousseau
_______________________________________________
opensc-devel mailing list
[email protected]
http://www.opensc-project.org/mailman/listinfo/opensc-devel