[zypp-commit] r10255 - in /trunk/libzypp: devel/devel.ma/Tools.h package/libzypp.changes zypp/RepoManager.cc zypp/TmpPath.cc zypp/TmpPath.h
Author: mlandres Date: Wed May 28 15:33:50 2008 New Revision: 10255 URL: http://svn.opensuse.org/viewcvs/zypp?rev=10255&view=rev Log: - Create missing directories when saving config files. (bnc #395026) - Fix undefined behaviour in RepoManager. Modified: trunk/libzypp/devel/devel.ma/Tools.h trunk/libzypp/package/libzypp.changes trunk/libzypp/zypp/RepoManager.cc trunk/libzypp/zypp/TmpPath.cc trunk/libzypp/zypp/TmpPath.h Modified: trunk/libzypp/devel/devel.ma/Tools.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/Tools.h?rev=10255&r1=10254&r2=10255&view=diff ============================================================================== --- trunk/libzypp/devel/devel.ma/Tools.h (original) +++ trunk/libzypp/devel/devel.ma/Tools.h Wed May 28 15:33:50 2008 @@ -112,6 +112,7 @@ inline RepoManager makeRepoManager( const Pathname & mgrdir_r ) { + return RepoManager(); RepoManagerOptions mgropt; mgropt.repoCachePath = mgrdir_r/"cache"; Modified: trunk/libzypp/package/libzypp.changes URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/package/libzypp.changes?rev=10255&r1=10254&r2=10255&view=diff ============================================================================== --- trunk/libzypp/package/libzypp.changes (original) +++ trunk/libzypp/package/libzypp.changes Wed May 28 15:33:50 2008 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +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 Modified: trunk/libzypp/zypp/RepoManager.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/RepoManager.cc?rev=10255&r1=10254&r2=10255&view=diff ============================================================================== --- trunk/libzypp/zypp/RepoManager.cc (original) +++ trunk/libzypp/zypp/RepoManager.cc Wed May 28 15:33:50 2008 @@ -772,16 +772,18 @@ 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 ); Modified: trunk/libzypp/zypp/TmpPath.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/TmpPath.cc?rev=10255&r1=10254&r2=10255&view=diff ============================================================================== --- trunk/libzypp/zypp/TmpPath.cc (original) +++ trunk/libzypp/zypp/TmpPath.cc Wed May 28 15:33:50 2008 @@ -175,8 +175,13 @@ 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 @@ -185,6 +190,7 @@ if ( ! buf ) { ERR << "Out of memory" << endl; + ::free( buf ); return; } @@ -248,8 +254,13 @@ 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 Modified: trunk/libzypp/zypp/TmpPath.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/TmpPath.h?rev=10255&r1=10254&r2=10255&view=diff ============================================================================== --- trunk/libzypp/zypp/TmpPath.h (original) +++ trunk/libzypp/zypp/TmpPath.h Wed May 28 15:33:50 2008 @@ -109,7 +109,6 @@ * 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. **/ @@ -154,7 +153,6 @@ * 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. **/ -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org
participants (1)
-
mlandres@svn.opensuse.org