fix makeTrashDir()
This commit is contained in:
13
Rdb.cpp
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;
|
||||
}
|
||||
|
||||
|
||||
|
10
main.cpp
10
main.cpp
@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user