fix makeTrashDir()

This commit is contained in:
mwells
2014-05-10 08:02:46 -07:00
parent 4c2a6a2519
commit 8e381504a1
2 changed files with 17 additions and 6 deletions

13
Rdb.cpp

@ -627,10 +627,15 @@ bool Rdb::deleteAllRecs ( collnum_t collnum ) {
bool makeTrashDir() {
char trash[1024];
sprintf(trash, "%strash/",g_hostdb.m_dir);
::mkdir ( trash,
S_IRUSR | S_IWUSR | S_IXUSR |
S_IRGRP | S_IWGRP | S_IXGRP |
S_IROTH | S_IXOTH ) ;
if ( ::mkdir ( trash,
S_IRUSR | S_IWUSR | S_IXUSR |
S_IRGRP | S_IWGRP | S_IXGRP |
S_IROTH | S_IXOTH ) == -1 ) {
log("dir: mkdir %s had error: %s",
trash,mstrerror(errno));
return false;
}
return true;
}

@ -2800,10 +2800,16 @@ int main2 ( int argc , char *argv[] ) {
// start up log file
if ( ! g_log.init( g_hostdb.m_logFilename ) ) {
fprintf (stderr,"db: Log file init failed.\n" ); return 1; }
fprintf (stderr,"db: Log file init failed. Exiting.\n" );
return 1;
}
// in case we do not have one, we need it for Images.cpp
makeTrashDir();
if ( ! makeTrashDir() ) {
fprintf (stderr,"db: failed to make trash dir. Exiting.\n" );
return 1;
}
g_errno = 0;