int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
				       const char *dir)
    {
    DIR *d;
    struct dirent *dstruct;
    int ret = 0;
    CRYPTO_w_lock(CRYPTO_LOCK_READDIR);
    d = opendir(dir);
    if(!d)
	{
	SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,ERR_R_MALLOC_FAILURE);
	goto err;
	}
    while((dstruct=readdir(d)))
	{
	char buf[1024];
	if(strlen(dir)+strlen(dstruct->d_name)+2 > sizeof buf)
	    {
	    SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG);
	    goto err;
	    }
	sprintf(buf,"%s/%s",dir,dstruct->d_name);
	if(!SSL_add_file_cert_subjects_to_stack(stack,buf))
	    goto err;
	}
    ret = 1;
err:
    CRYPTO_w_unlock(CRYPTO_LOCK_READDIR);
    return ret;
    }
['int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,\n\t\t\t\t       const char *dir)\n    {\n    DIR *d;\n    struct dirent *dstruct;\n    int ret = 0;\n    CRYPTO_w_lock(CRYPTO_LOCK_READDIR);\n    d = opendir(dir);\n    if(!d)\n\t{\n\tSSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,ERR_R_MALLOC_FAILURE);\n\tgoto err;\n\t}\n    while((dstruct=readdir(d)))\n\t{\n\tchar buf[1024];\n\tif(strlen(dir)+strlen(dstruct->d_name)+2 > sizeof buf)\n\t    {\n\t    SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG);\n\t    goto err;\n\t    }\n\tsprintf(buf,"%s/%s",dir,dstruct->d_name);\n\tif(!SSL_add_file_cert_subjects_to_stack(stack,buf))\n\t    goto err;\n\t}\n    ret = 1;\nerr:\n    CRYPTO_w_unlock(CRYPTO_LOCK_READDIR);\n    return ret;\n    }', 'void CRYPTO_lock(int mode, int type, const char *file, int line)\n\t{\n#ifdef LOCK_DEBUG\n\t\t{\n\t\tchar *rw_text,*operation_text;\n\t\tif (mode & CRYPTO_LOCK)\n\t\t\toperation_text="lock  ";\n\t\telse if (mode & CRYPTO_UNLOCK)\n\t\t\toperation_text="unlock";\n\t\telse\n\t\t\toperation_text="ERROR ";\n\t\tif (mode & CRYPTO_READ)\n\t\t\trw_text="r";\n\t\telse if (mode & CRYPTO_WRITE)\n\t\t\trw_text="w";\n\t\telse\n\t\t\trw_text="ERROR";\n\t\tfprintf(stderr,"lock:%08lx:(%s)%s %-18s %s:%d\\n",\n\t\t\tCRYPTO_thread_id(), rw_text, operation_text,\n\t\t\tCRYPTO_get_lock_name(type), file, line);\n\t\t}\n#endif\n\tif (locking_callback != NULL)\n\t\tlocking_callback(mode,type,file,line);\n\t}']