Browse code

libclamav/others.c: move cli_gentemp*() to others_common.c clamav-milter: don't link to libclamav (bb#1463)

git-svn: trunk@4938

Tomasz Kojm authored on 2009/03/13 19:56:53
Showing 7 changed files
... ...
@@ -1,3 +1,8 @@
1
+Fri Mar 13 11:58:38 CET 2009 (tk)
2
+---------------------------------
3
+ * libclamav/others.c: move cli_gentemp*() to others_common.c
4
+ * clamav-milter: don't link to libclamav (bb#1463)
5
+
1 6
 Thu Mar 12 18:00:35 EET 2009 (edwin)
2 7
 ------------------------------------
3 8
  * libclamav/others_common.c: add missing ifdefs
... ...
@@ -44,7 +44,8 @@ man_MANS = $(top_builddir)/docs/man/clamav-milter.8
44 44
 endif
45 45
 endif
46 46
 
47
+DEFS = @DEFS@ -DCL_NOLIBCLAMAV
47 48
 CFLAGS=`echo "@CFLAGS@" | sed -e 's/-Wwrite-strings//' -e 's/-Werror /-Werror -Wno-error=format-nonliteral /'`
48
-LIBS = $(top_builddir)/libclamav/libclamav.la @CLAMAV_MILTER_LIBS@ @THREAD_LIBS@
49
+LIBS = $(top_builddir)/libclamav/libclamav_internal_utils.la @CLAMAV_MILTER_LIBS@ @THREAD_LIBS@
49 50
 AM_CPPFLAGS = -I$(top_srcdir)/clamd -I$(top_srcdir)/libclamav -I$(top_srcdir)/shared -I$(top_srcdir)
50 51
 CLEANFILES=*.gcda *.gcno
... ...
@@ -135,7 +135,7 @@ CURSES_CPPFLAGS = @CURSES_CPPFLAGS@
135 135
 CURSES_LIBS = @CURSES_LIBS@
136 136
 CYGPATH_W = @CYGPATH_W@
137 137
 DBDIR = @DBDIR@
138
-DEFS = @DEFS@
138
+DEFS = @DEFS@ -DCL_NOLIBCLAMAV
139 139
 DEPDIR = @DEPDIR@
140 140
 DSYMUTIL = @DSYMUTIL@
141 141
 DUMPBIN = @DUMPBIN@
... ...
@@ -170,7 +170,7 @@ LIBCLAMAV_LIBS = @LIBCLAMAV_LIBS@
170 170
 LIBCLAMAV_VERSION = @LIBCLAMAV_VERSION@
171 171
 LIBLTDL = @LIBLTDL@
172 172
 LIBOBJS = @LIBOBJS@
173
-LIBS = $(top_builddir)/libclamav/libclamav.la @CLAMAV_MILTER_LIBS@ @THREAD_LIBS@
173
+LIBS = $(top_builddir)/libclamav/libclamav_internal_utils.la @CLAMAV_MILTER_LIBS@ @THREAD_LIBS@
174 174
 LIBTOOL = @LIBTOOL@
175 175
 LIPO = @LIPO@
176 176
 LN_S = @LN_S@
... ...
@@ -76,6 +76,8 @@ endif
76 76
 
77 77
 libclamav_internal_utils_la_SOURCES=str.c \
78 78
 				    str.h \
79
+				    md5.c \
80
+				    md5.h \
79 81
 				    others_common.c \
80 82
 				    others.h \
81 83
 				    regex/strlcpy.c \
... ...
@@ -116,8 +118,6 @@ libclamav_la_SOURCES = \
116 116
         matcher-bm.h \
117 117
         matcher.c \
118 118
         matcher.h \
119
-        md5.c \
120
-        md5.h \
121 119
         others.c \
122 120
         others.h \
123 121
         readdb.c \
... ...
@@ -92,10 +92,10 @@ libLTLIBRARIES_INSTALL = $(INSTALL)
92 92
 LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES)
93 93
 @ENABLE_UNRAR_TRUE@am__DEPENDENCIES_1 = libclamunrar_iface.la
94 94
 am_libclamav_la_OBJECTS = matcher-ac.lo matcher-bm.lo matcher.lo \
95
-	md5.lo others.lo readdb.lo cvd.lo dsig.lo scanners.lo \
96
-	textdet.lo filetypes.lo rtf.lo blob.lo mbox.lo message.lo \
97
-	table.lo text.lo ole2_extract.lo vba_extract.lo msexpand.lo \
98
-	pe.lo disasm.lo upx.lo htmlnorm.lo chmunpack.lo rebuildpe.lo \
95
+	others.lo readdb.lo cvd.lo dsig.lo scanners.lo textdet.lo \
96
+	filetypes.lo rtf.lo blob.lo mbox.lo message.lo table.lo \
97
+	text.lo ole2_extract.lo vba_extract.lo msexpand.lo pe.lo \
98
+	disasm.lo upx.lo htmlnorm.lo chmunpack.lo rebuildpe.lo \
99 99
 	petite.lo wwunpack.lo unsp.lo aspack.lo packlibs.lo fsg.lo \
100 100
 	mew.lo upack.lo line.lo untar.lo unzip.lo inflate64.lo \
101 101
 	special.lo binhex.lo is_tar.lo tnef.lo autoit.lo unarj.lo \
... ...
@@ -110,7 +110,7 @@ libclamav_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
110 110
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
111 111
 	$(libclamav_la_LDFLAGS) $(LDFLAGS) -o $@
112 112
 libclamav_internal_utils_la_LIBADD =
113
-am__libclamav_internal_utils_la_SOURCES_DIST = str.c str.h \
113
+am__libclamav_internal_utils_la_SOURCES_DIST = str.c str.h md5.c md5.h \
114 114
 	others_common.c others.h regex/strlcpy.c regex/regcomp.c \
115 115
 	regex/regerror.c regex/regexec.c regex/regfree.c \
116 116
 	regex/cclass.h regex/cname.h regex/regex.h regex/regex2.h \
... ...
@@ -119,6 +119,7 @@ am__libclamav_internal_utils_la_SOURCES_DIST = str.c str.h \
119 119
 @LINK_TOMMATH_FALSE@	libclamav_internal_utils_la-bignum.lo
120 120
 am_libclamav_internal_utils_la_OBJECTS =  \
121 121
 	libclamav_internal_utils_la-str.lo \
122
+	libclamav_internal_utils_la-md5.lo \
122 123
 	libclamav_internal_utils_la-others_common.lo \
123 124
 	libclamav_internal_utils_la-strlcpy.lo \
124 125
 	libclamav_internal_utils_la-regcomp.lo \
... ...
@@ -389,11 +390,11 @@ EXTRA_DIST = $(am__append_4) regex/engine.c libclamav.map \
389 389
 
390 390
 @ENABLE_UNRAR_TRUE@IFACELIBADD = -dlopen libclamunrar_iface.la
391 391
 @ENABLE_UNRAR_TRUE@IFACEDEP = libclamunrar_iface.la
392
-libclamav_internal_utils_la_SOURCES = str.c str.h others_common.c \
393
-	others.h regex/strlcpy.c regex/regcomp.c regex/regerror.c \
394
-	regex/regexec.c regex/regfree.c regex/cclass.h regex/cname.h \
395
-	regex/regex.h regex/regex2.h regex/utils.h bignum.h \
396
-	$(am__append_6)
392
+libclamav_internal_utils_la_SOURCES = str.c str.h md5.c md5.h \
393
+	others_common.c others.h regex/strlcpy.c regex/regcomp.c \
394
+	regex/regerror.c regex/regexec.c regex/regfree.c \
395
+	regex/cclass.h regex/cname.h regex/regex.h regex/regex2.h \
396
+	regex/utils.h bignum.h $(am__append_6)
397 397
 libclamav_internal_utils_la_LDFLAGS = -static
398 398
 libclamav_internal_utils_la_CFLAGS = -fPIC -DPIC
399 399
 libclamav_la_LIBADD = @LIBLTDL@ $(IFACELIBADD) lzma/liblzma.la libclamav_internal_utils.la @LIBCLAMAV_LIBS@ @THREAD_LIBS@
... ...
@@ -409,8 +410,6 @@ libclamav_la_SOURCES = \
409 409
         matcher-bm.h \
410 410
         matcher.c \
411 411
         matcher.h \
412
-        md5.c \
413
-        md5.h \
414 412
         others.c \
415 413
         others.h \
416 414
         readdb.c \
... ...
@@ -679,6 +678,7 @@ distclean-compile:
679 679
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/is_tar.Plo@am__quote@
680 680
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/js-norm.Plo@am__quote@
681 681
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libclamav_internal_utils_la-bignum.Plo@am__quote@
682
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libclamav_internal_utils_la-md5.Plo@am__quote@
682 683
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libclamav_internal_utils_la-others_common.Plo@am__quote@
683 684
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libclamav_internal_utils_la-regcomp.Plo@am__quote@
684 685
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libclamav_internal_utils_la-regerror.Plo@am__quote@
... ...
@@ -692,7 +692,6 @@ distclean-compile:
692 692
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matcher-bm.Plo@am__quote@
693 693
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/matcher.Plo@am__quote@
694 694
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbox.Plo@am__quote@
695
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Plo@am__quote@
696 695
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/message.Plo@am__quote@
697 696
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mew.Plo@am__quote@
698 697
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpool.Plo@am__quote@
... ...
@@ -801,6 +800,13 @@ libclamav_internal_utils_la-str.lo: str.c
801 801
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
802 802
 @am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libclamav_internal_utils_la_CFLAGS) $(CFLAGS) -c -o libclamav_internal_utils_la-str.lo `test -f 'str.c' || echo '$(srcdir)/'`str.c
803 803
 
804
+libclamav_internal_utils_la-md5.lo: md5.c
805
+@am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libclamav_internal_utils_la_CFLAGS) $(CFLAGS) -MT libclamav_internal_utils_la-md5.lo -MD -MP -MF $(DEPDIR)/libclamav_internal_utils_la-md5.Tpo -c -o libclamav_internal_utils_la-md5.lo `test -f 'md5.c' || echo '$(srcdir)/'`md5.c
806
+@am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libclamav_internal_utils_la-md5.Tpo $(DEPDIR)/libclamav_internal_utils_la-md5.Plo
807
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='md5.c' object='libclamav_internal_utils_la-md5.lo' libtool=yes @AMDEPBACKSLASH@
808
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
809
+@am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libclamav_internal_utils_la_CFLAGS) $(CFLAGS) -c -o libclamav_internal_utils_la-md5.lo `test -f 'md5.c' || echo '$(srcdir)/'`md5.c
810
+
804 811
 libclamav_internal_utils_la-others_common.lo: others_common.c
805 812
 @am__fastdepCC_TRUE@	$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libclamav_internal_utils_la_CFLAGS) $(CFLAGS) -MT libclamav_internal_utils_la-others_common.lo -MD -MP -MF $(DEPDIR)/libclamav_internal_utils_la-others_common.Tpo -c -o libclamav_internal_utils_la-others_common.lo `test -f 'others_common.c' || echo '$(srcdir)/'`others_common.c
806 813
 @am__fastdepCC_TRUE@	mv -f $(DEPDIR)/libclamav_internal_utils_la-others_common.Tpo $(DEPDIR)/libclamav_internal_utils_la-others_common.Plo
... ...
@@ -58,12 +58,6 @@
58 58
 #include <crtdbg.h>
59 59
 #endif
60 60
 
61
-#ifdef CL_THREAD_SAFE
62
-#  include <pthread.h>
63
-static pthread_mutex_t cli_gentemp_mutex = PTHREAD_MUTEX_INITIALIZER;
64
-
65
-#endif
66
-
67 61
 #if defined(HAVE_READDIR_R_3) || defined(HAVE_READDIR_R_2)
68 62
 #include <limits.h>
69 63
 #include <stddef.h>
... ...
@@ -87,8 +81,6 @@ static pthread_mutex_t cli_gentemp_mutex = PTHREAD_MUTEX_INITIALIZER;
87 87
 #define       P_tmpdir        "C:\\WINDOWS\\TEMP"
88 88
 #endif
89 89
 
90
-static unsigned char name_salt[16] = { 16, 38, 97, 12, 8, 4, 72, 196, 217, 144, 33, 124, 18, 11, 17, 253 };
91
-
92 90
 int (*cli_unrar_open)(int fd, const char *dirname, unrar_state_t *state);
93 91
 int (*cli_unrar_extract_next_prepare)(unrar_state_t *state, const char *dirname);
94 92
 int (*cli_unrar_extract_next)(unrar_state_t *state, const char *dirname);
... ...
@@ -592,121 +584,6 @@ char *cli_md5file(const char *filename)
592 592
     return md5str;
593 593
 }
594 594
 
595
-static char *cli_md5buff(const unsigned char *buffer, unsigned int len, unsigned char *dig)
596
-{
597
-	unsigned char digest[16];
598
-	char *md5str, *pt;
599
-	cli_md5_ctx ctx;
600
-	int i;
601
-
602
-
603
-    cli_md5_init(&ctx);
604
-    cli_md5_update(&ctx, buffer, len);
605
-    cli_md5_final(digest, &ctx);
606
-
607
-    if(dig)
608
-	memcpy(dig, digest, 16);
609
-
610
-    if(!(md5str = (char *) cli_calloc(32 + 1, sizeof(char))))
611
-	return NULL;
612
-
613
-    pt = md5str;
614
-    for(i = 0; i < 16; i++) {
615
-	sprintf(pt, "%02x", digest[i]);
616
-	pt += 2;
617
-    }
618
-
619
-    return md5str;
620
-}
621
-
622
-unsigned int cli_rndnum(unsigned int max)
623
-{
624
-    if(name_salt[0] == 16) { /* minimizes re-seeding after the first call to cli_gentemp() */
625
-	    struct timeval tv;
626
-	gettimeofday(&tv, (struct timezone *) 0);
627
-	srand(tv.tv_usec+clock());
628
-    }
629
-
630
-    return 1 + (unsigned int) (max * (rand() / (1.0 + RAND_MAX)));
631
-}
632
-
633
-char *cli_gentemp(const char *dir)
634
-{
635
-	char *name, *tmp;
636
-        const char *mdir;
637
-	unsigned char salt[16 + 32];
638
-	int i;
639
-
640
-    if(!dir) {
641
-	if((mdir = getenv("TMPDIR")) == NULL)
642
-#ifdef P_tmpdir
643
-	    mdir = P_tmpdir;
644
-#else
645
-	    mdir = "/tmp";
646
-#endif
647
-    } else
648
-	mdir = dir;
649
-
650
-    name = (char *) cli_calloc(strlen(mdir) + 1 + 32 + 1 + 7, sizeof(char));
651
-    if(!name) {
652
-	cli_dbgmsg("cli_gentemp('%s'): out of memory\n", mdir);
653
-	return NULL;
654
-    }
655
-
656
-#ifdef CL_THREAD_SAFE
657
-    pthread_mutex_lock(&cli_gentemp_mutex);
658
-#endif
659
-
660
-    memcpy(salt, name_salt, 16);
661
-
662
-    for(i = 16; i < 48; i++)
663
-	salt[i] = cli_rndnum(255);
664
-
665
-    tmp = cli_md5buff(salt, 48, name_salt);
666
-
667
-#ifdef CL_THREAD_SAFE
668
-    pthread_mutex_unlock(&cli_gentemp_mutex);
669
-#endif
670
-
671
-    if(!tmp) {
672
-	free(name);
673
-	cli_dbgmsg("cli_gentemp('%s'): out of memory\n", mdir);
674
-	return NULL;
675
-    }
676
-
677
-#ifdef	C_WINDOWS
678
-	sprintf(name, "%s\\clamav-", mdir);
679
-#else
680
-	sprintf(name, "%s/clamav-", mdir);
681
-#endif
682
-    strncat(name, tmp, 32);
683
-    free(tmp);
684
-
685
-    return(name);
686
-}
687
-
688
-int cli_gentempfd(const char *dir, char **name, int *fd)
689
-{
690
-
691
-    *name = cli_gentemp(dir);
692
-    if(!*name)
693
-	return CL_EMEM;
694
-
695
-    *fd = open(*name, O_RDWR|O_CREAT|O_TRUNC|O_BINARY|O_EXCL, S_IRWXU);
696
-    /*
697
-     * EEXIST is almost impossible to occur, so we just treat it as other
698
-     * errors
699
-     */
700
-   if(*fd == -1) {
701
-        char err[128];
702
-	cli_errmsg("cli_gentempfd: Can't create temporary file %s: %s\n", *name, cli_strerror(errno, err, sizeof(err)));
703
-	free(*name);
704
-	return CL_ECREAT;
705
-    }
706
-
707
-    return CL_SUCCESS;
708
-}
709
-
710 595
 /* Function: unlink
711 596
         unlink() with error checking
712 597
 */
... ...
@@ -65,14 +65,18 @@
65 65
 #include "regex/regex.h"
66 66
 #include "ltdl.h"
67 67
 #include "matcher-ac.h"
68
+#include "md5.h"
68 69
 
69 70
 #ifndef	O_BINARY
70 71
 #define	O_BINARY	0
71 72
 #endif
72 73
 
74
+static unsigned char name_salt[16] = { 16, 38, 97, 12, 8, 4, 72, 196, 217, 144, 33, 124, 18, 11, 17, 253 };
75
+
73 76
 #ifdef CL_THREAD_SAFE
74 77
 #  include <pthread.h>
75 78
 
79
+static pthread_mutex_t cli_gentemp_mutex = PTHREAD_MUTEX_INITIALIZER;
76 80
 # ifndef HAVE_CTIME_R
77 81
 static pthread_mutex_t cli_ctime_mutex = PTHREAD_MUTEX_INITIALIZER;
78 82
 # endif
... ...
@@ -699,3 +703,116 @@ const char* cli_strerror(int errnum, char *buf, size_t len)
699 699
     return buf;
700 700
 }
701 701
 
702
+static char *cli_md5buff(const unsigned char *buffer, unsigned int len, unsigned char *dig)
703
+{
704
+	unsigned char digest[16];
705
+	char *md5str, *pt;
706
+	cli_md5_ctx ctx;
707
+	int i;
708
+
709
+
710
+    cli_md5_init(&ctx);
711
+    cli_md5_update(&ctx, buffer, len);
712
+    cli_md5_final(digest, &ctx);
713
+
714
+    if(dig)
715
+	memcpy(dig, digest, 16);
716
+
717
+    if(!(md5str = (char *) cli_calloc(32 + 1, sizeof(char))))
718
+	return NULL;
719
+
720
+    pt = md5str;
721
+    for(i = 0; i < 16; i++) {
722
+	sprintf(pt, "%02x", digest[i]);
723
+	pt += 2;
724
+    }
725
+
726
+    return md5str;
727
+}
728
+
729
+unsigned int cli_rndnum(unsigned int max)
730
+{
731
+    if(name_salt[0] == 16) { /* minimizes re-seeding after the first call to cli_gentemp() */
732
+	    struct timeval tv;
733
+	gettimeofday(&tv, (struct timezone *) 0);
734
+	srand(tv.tv_usec+clock());
735
+    }
736
+
737
+    return 1 + (unsigned int) (max * (rand() / (1.0 + RAND_MAX)));
738
+}
739
+
740
+char *cli_gentemp(const char *dir)
741
+{
742
+	char *name, *tmp;
743
+        const char *mdir;
744
+	unsigned char salt[16 + 32];
745
+	int i;
746
+
747
+    if(!dir) {
748
+	if((mdir = getenv("TMPDIR")) == NULL)
749
+#ifdef P_tmpdir
750
+	    mdir = P_tmpdir;
751
+#else
752
+	    mdir = "/tmp";
753
+#endif
754
+    } else
755
+	mdir = dir;
756
+
757
+    name = (char *) cli_calloc(strlen(mdir) + 1 + 32 + 1 + 7, sizeof(char));
758
+    if(!name) {
759
+	cli_dbgmsg("cli_gentemp('%s'): out of memory\n", mdir);
760
+	return NULL;
761
+    }
762
+
763
+#ifdef CL_THREAD_SAFE
764
+    pthread_mutex_lock(&cli_gentemp_mutex);
765
+#endif
766
+
767
+    memcpy(salt, name_salt, 16);
768
+
769
+    for(i = 16; i < 48; i++)
770
+	salt[i] = cli_rndnum(255);
771
+
772
+    tmp = cli_md5buff(salt, 48, name_salt);
773
+
774
+#ifdef CL_THREAD_SAFE
775
+    pthread_mutex_unlock(&cli_gentemp_mutex);
776
+#endif
777
+
778
+    if(!tmp) {
779
+	free(name);
780
+	cli_dbgmsg("cli_gentemp('%s'): out of memory\n", mdir);
781
+	return NULL;
782
+    }
783
+
784
+#ifdef	C_WINDOWS
785
+	sprintf(name, "%s\\clamav-", mdir);
786
+#else
787
+	sprintf(name, "%s/clamav-", mdir);
788
+#endif
789
+    strncat(name, tmp, 32);
790
+    free(tmp);
791
+
792
+    return(name);
793
+}
794
+
795
+int cli_gentempfd(const char *dir, char **name, int *fd)
796
+{
797
+
798
+    *name = cli_gentemp(dir);
799
+    if(!*name)
800
+	return CL_EMEM;
801
+
802
+    *fd = open(*name, O_RDWR|O_CREAT|O_TRUNC|O_BINARY|O_EXCL, S_IRWXU);
803
+    /*
804
+     * EEXIST is almost impossible to occur, so we just treat it as other
805
+     * errors
806
+     */
807
+   if(*fd == -1) {
808
+	cli_errmsg("cli_gentempfd: Can't create temporary file %s: %s\n", *name, strerror(errno));
809
+	free(*name);
810
+	return CL_ECREAT;
811
+    }
812
+
813
+    return CL_SUCCESS;
814
+}