Changeset View
Changeset View
Standalone View
Standalone View
b/g10/tdbio.c
Context not available. | |||||
int | int | ||||
tdbio_set_dbname( const char *new_dbname, int create, int *r_nofile) | tdbio_set_dbname( const char *new_dbname, int create, int *r_nofile) | ||||
{ | { | ||||
char *fname; | char *fname, *p; | ||||
struct stat statbuf; | struct stat statbuf; | ||||
static int initialized = 0; | static int initialized = 0; | ||||
Context not available. | |||||
/* OK, we have the valid trustdb.gpg already. */ | /* OK, we have the valid trustdb.gpg already. */ | ||||
return 0; | return 0; | ||||
/* | |||||
* Make sure the directory exists. This should be done before | |||||
* acquiring the lock, which assumes the directory existence. | |||||
*/ | |||||
p = strrchr( fname, DIRSEP_C ); | |||||
assert(p); /* See the code above. Always, it has DIRSEP_C. */ | |||||
*p = 0; | |||||
if( access( fname, F_OK ) ) { | |||||
try_make_homedir( fname ); | |||||
if (access (fname, F_OK )) | |||||
log_fatal (_("%s: directory does not exist!\n"), p); | |||||
} | |||||
*p = DIRSEP_C; | |||||
take_write_lock (); | take_write_lock (); | ||||
if( access( fname, R_OK ) ) { | if( access( fname, R_OK ) ) { | ||||
Context not available. | |||||
FILE *fp; | FILE *fp; | ||||
TRUSTREC rec; | TRUSTREC rec; | ||||
int rc; | int rc; | ||||
char *p = strrchr( fname, DIRSEP_C ); | |||||
mode_t oldmask; | mode_t oldmask; | ||||
assert(p); | |||||
*p = 0; | |||||
if( access( fname, F_OK ) ) { | |||||
try_make_homedir( fname ); | |||||
if (access (fname, F_OK )) | |||||
log_fatal (_("%s: directory does not exist!\n"), fname); | |||||
} | |||||
*p = DIRSEP_C; | |||||
oldmask=umask(077); | oldmask=umask(077); | ||||
if (is_secured_filename (fname)) { | if (is_secured_filename (fname)) { | ||||
fp = NULL; | fp = NULL; | ||||
Context not available. |