projects
/
chise
/
libchise.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
f63c773
)
(CHISE_Attribute_Table_open): Create required directories when running
author
tomo
<tomo>
Mon, 6 Oct 2003 02:37:07 +0000
(
02:37
+0000)
committer
tomo
<tomo>
Mon, 6 Oct 2003 02:37:07 +0000
(
02:37
+0000)
with create mode.
chise.c
patch
|
blob
|
history
diff --git
a/chise.c
b/chise.c
index
04678c8
..
da12d1b
100644
(file)
--- a/
chise.c
+++ b/
chise.c
@@
-1,4
+1,7
@@
#include <stdlib.h>
#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
@@
-497,11
+500,15
@@
CHISE_Attribute_Table_open (const unsigned char *db_dir,
int len, flen, i;
int size;
char *db_file_name, *sp;
int len, flen, i;
int size;
char *db_file_name, *sp;
+ struct stat statbuf;
status = db_create (&dbase, NULL, 0);
if (status)
return NULL;
status = db_create (&dbase, NULL, 0);
if (status)
return NULL;
+ if ( (accessmask & DB_CREATE) && stat (db_dir, &statbuf) )
+ mkdir (db_dir, modemask);
+
len = strlen (db_dir);
flen = strlen (feature);
size = len + strlen (encoding) + flen * 3 + 4;
len = strlen (db_dir);
flen = strlen (feature);
size = len + strlen (encoding) + flen * 3 + 4;
@@
-513,6
+520,10
@@
CHISE_Attribute_Table_open (const unsigned char *db_dir,
db_file_name[len] = '\0';
}
strcat (db_file_name, encoding);
db_file_name[len] = '\0';
}
strcat (db_file_name, encoding);
+
+ if ( (accessmask & DB_CREATE) && stat (db_file_name, &statbuf) )
+ mkdir (db_file_name, modemask);
+
strcat (db_file_name, "/");
/* strcat (db_file_name, feature); */
sp = &db_file_name[strlen (db_file_name)];
strcat (db_file_name, "/");
/* strcat (db_file_name, feature); */
sp = &db_file_name[strlen (db_file_name)];