- Fix undefined behaviour in RepoManager.
inline RepoManager makeRepoManager( const Pathname & mgrdir_r )
{
+ return RepoManager();
RepoManagerOptions mgropt;
mgropt.repoCachePath = mgrdir_r/"cache";
-------------------------------------------------------------------
+Wed May 28 15:30:24 CEST 2008 - ma@suse.de
+
+- Create missing directories when saving config files. (bnc #395026)
+- Fix undefined behaviour in RepoManager.
+- revision 10255
+
+-------------------------------------------------------------------
Wed May 28 15:23:44 CEST 2008 - schubi@suse.de
- SOLVER_ERASE_SOLVABLE_NAME: As we do not know, if this request has come
ManagedFile guard( solvfile, filesystem::unlink );
ostringstream cmd;
- const char *toFile = str::gsub(solvfile.asString(),"\"","\\\"").c_str();
+ std::string toFile( str::gsub(solvfile.asString(),"\"","\\\"") );
if ( repokind.toEnum() == RepoType::RPMPLAINDIR_e )
{
- const char * from = str::gsub(
- info.baseUrlsBegin()->getPathName(),"\"","\\\"").c_str();
- cmd << str::form( "repo2solv.sh \"%s\" > \"%s\"", from , toFile );
- } else
+ cmd << str::form( "repo2solv.sh \"%s\" > \"%s\"",
+ str::gsub( info.baseUrlsBegin()->getPathName(),"\"","\\\"" ).c_str(),
+ toFile.c_str() );
+ }
+ else
{
- const char * from = str::gsub(rawpath.asString(),"\"","\\\"").c_str();
- cmd << str::form( "repo2solv.sh \"%s\" > \"%s\"", from, toFile );
+ cmd << str::form( "repo2solv.sh \"%s\" > \"%s\"",
+ str::gsub( rawpath.asString(),"\"","\\\"" ).c_str(),
+ toFile.c_str() );
}
MIL << "Executing: " << cmd.str() << endl;
ExternalProgram prog( cmd.str(), ExternalProgram::Stderr_To_Stdout );
PathInfo p( inParentDir_r );
if ( ! p.isDir() )
{
- ERR << "Parent directory does not exist: " << p << endl;
- return;
+ filesystem::assert_dir( inParentDir_r );
+ p(); // re-stat
+ if ( ! p.isDir() )
+ {
+ ERR << "Parent directory can't be created: " << p << endl;
+ return;
+ }
}
// create the temp file
if ( ! buf )
{
ERR << "Out of memory" << endl;
+ ::free( buf );
return;
}
PathInfo p( inParentDir_r );
if ( ! p.isDir() )
{
- ERR << "Parent directory does not exist: " << p << endl;
- return;
+ filesystem::assert_dir( inParentDir_r );
+ p(); // re-stat
+ if ( ! p.isDir() )
+ {
+ ERR << "Parent directory does not exist: " << p << endl;
+ return;
+ }
}
// create the temp dir
* name unique. Different location and file prefix may be passed to
* the ctor. TmpFile is created with mode 0600.
*
- * The directory where the temporary file is to be created must exist.
* TmpFile provides the Pathname of the temporary file, or an empty
* path in case of any error.
**/
* the name unique. Different location and file prefix may be passed
* to the ctor. TmpDir is created with mode 0700.
*
- * The directory where the temporary directory is to be created must exist.
* TmpDir provides the Pathname of the temporary directory , or an empty
* path in case of any error.
**/