@@ -296,6 +296,8 @@ class NBackup
296296 pr_error (status, " nbackup needs local access to database file" );
297297 }
298298
299+ toSystem (decompress);
300+ toSystem (db);
299301 expandDatabaseName (db, dbname, NULL );
300302
301303 if (!uSvc->isService ())
@@ -364,7 +366,7 @@ class NBackup
364366 void internal_unlock_database ();
365367 void attach_database ();
366368 void detach_database ();
367- string to_system ( const PathName & from);
369+ void toSystem (AbstractString & from);
368370
369371 // Create/open database and backup
370372 void open_database_write ();
@@ -580,12 +582,10 @@ void NBackup::close_database()
580582#endif
581583}
582584
583- string NBackup::to_system ( const PathName & from)
585+ void NBackup::toSystem (AbstractString & from)
584586{
585- string to = from.ToString ();
586587 if (uSvc->utf8FileNames ())
587- ISC_utf8ToSystem (to);
588- return to;
588+ ISC_utf8ToSystem (from);
589589}
590590
591591
@@ -597,14 +597,13 @@ void NBackup::open_backup_scan()
597597 return ;
598598 }
599599
600- string nm = to_system (bakname);
601600#ifdef WIN_NT
602- backup = CreateFile (nm .c_str (), GENERIC_READ, 0 ,
601+ backup = CreateFile (bakname .c_str (), GENERIC_READ, 0 ,
603602 NULL , OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL );
604603 if (backup != INVALID_HANDLE_VALUE)
605604 return ;
606605#else
607- backup = os_utils::open (nm .c_str (), O_RDONLY | O_LARGEFILE);
606+ backup = os_utils::open (bakname .c_str (), O_RDONLY | O_LARGEFILE);
608607 if (backup >= 0 )
609608 return ;
610609#endif
@@ -752,7 +751,6 @@ void NBackup::open_backup_decompress()
752751
753752void NBackup::create_backup ()
754753{
755- string nm = to_system (bakname);
756754#ifdef WIN_NT
757755 if (bakname == " stdout" ) {
758756 backup = GetStdHandle (STD_OUTPUT_HANDLE);
@@ -767,7 +765,7 @@ void NBackup::create_backup()
767765 // avoids an issue where writing to a file across a network can occasionally
768766 // return ERROR_ACCESS_DENIED.
769767
770- backup = CreateFile (nm .c_str (), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_DELETE,
768+ backup = CreateFile (bakname .c_str (), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_DELETE,
771769 NULL , CREATE_NEW, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL );
772770 }
773771 if (backup != INVALID_HANDLE_VALUE)
@@ -778,7 +776,7 @@ void NBackup::create_backup()
778776 backup = 1 ; // Posix file handle for stdout
779777 return ;
780778 }
781- backup = os_utils::open (nm .c_str (), O_WRONLY | O_CREAT | O_EXCL | O_LARGEFILE, 0660 );
779+ backup = os_utils::open (bakname .c_str (), O_WRONLY | O_CREAT | O_EXCL | O_LARGEFILE, 0660 );
782780 if (backup >= 0 )
783781 return ;
784782#endif
@@ -934,6 +932,7 @@ void NBackup::attach_database()
934932 }
935933
936934 ClumpletWriter dpb (ClumpletReader::dpbList, MAX_DPB_SIZE);
935+ uSvc->fillDpb (dpb);
937936
938937 const unsigned char * authBlock;
939938 unsigned int authBlockSize = uSvc->getAuthBlock (&authBlock);
@@ -1181,7 +1180,10 @@ void NBackup::backup_database(int level, const PathName& fname)
11811180 detach_database ();
11821181
11831182 if (fname.hasData ())
1183+ {
11841184 bakname = fname;
1185+ toSystem (bakname);
1186+ }
11851187 else
11861188 {
11871189 // Let's generate nice new filename
@@ -1557,6 +1559,8 @@ void NBackup::restore_database(const BackupFiles& files)
15571559 delete[] page_buffer;
15581560 return ;
15591561 }
1562+ toSystem (bakname);
1563+
15601564 // Never reaches this point when run as service
15611565 try {
15621566 fb_assert (!uSvc->isService ());
@@ -1591,6 +1595,7 @@ void NBackup::restore_database(const BackupFiles& files)
15911595 return ;
15921596 }
15931597 bakname = files[curLevel];
1598+ toSystem (bakname);
15941599 open_backup_scan ();
15951600 }
15961601
0 commit comments