[yast-commit] r57295 - in /trunk/storage/libstorage/src: Storage.cc Storage.h Volume.cc

Author: aschnell Date: Fri May 22 11:18:58 2009 New Revision: 57295 URL: http://svn.opensuse.org/viewcvs/yast?rev=57295&view=rev Log: - tmpdir cleanup Modified: trunk/storage/libstorage/src/Storage.cc trunk/storage/libstorage/src/Storage.h trunk/storage/libstorage/src/Volume.cc Modified: trunk/storage/libstorage/src/Storage.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.cc... ============================================================================== --- trunk/storage/libstorage/src/Storage.cc (original) +++ trunk/storage/libstorage/src/Storage.cc Fri May 22 11:18:58 2009 @@ -116,7 +116,7 @@ Storage::initialize() { initialized = true; - char tbuf[32] = "/tmp/liby2storageXXXXXX"; + char tbuf[32] = "/tmp/libstorage-XXXXXX"; if( mkdtemp( tbuf )==NULL ) { y2err("tmpdir creation " << tbuf << " failed. Aborting..."); @@ -125,7 +125,6 @@ else { tempdir = tbuf; - rmdir( tempdir.c_str() ); } if( access( "/etc/sysconfig/storage", R_OK )==0 ) { @@ -273,15 +272,11 @@ logContainersAndVolumes(logdir); clearPointerList(cont); deleteBackups(); - if( !tempdir.empty() && access( tempdir.c_str(), R_OK )==0 ) - { - SystemCmd c( "rmdir " + tempdir ); - if( c.retcode()!=0 ) - { - y2err("stray tmpfile"); - c.execute( "ls -l" + tempdir ); - } - } + if (!tempdir.empty() && rmdir(tempdir.c_str()) != 0) + { + y2err("stray tmpfile"); + SystemCmd("ls -l " + quote(tempdir)); + } delete fstab; y2mil("destructed Storage"); } @@ -293,12 +288,6 @@ detectObjects(); } -const string& Storage::tmpDir() const - { - if( access( tempdir.c_str(), W_OK )!= 0 ) - mkdir( tempdir.c_str(), 0700 ); - return( tempdir ); - } void Storage::detectArch() @@ -5484,7 +5473,6 @@ { umountDevice( device ); rmdir( mp.c_str() ); - rmdir( tmpDir().c_str() ); } if( vol->needCrsetup() && vol->doCrsetup() ) Modified: trunk/storage/libstorage/src/Storage.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.h?... ============================================================================== --- trunk/storage/libstorage/src/Storage.h (original) +++ trunk/storage/libstorage/src/Storage.h Fri May 22 11:18:58 2009 @@ -222,7 +222,7 @@ const string& tDir() const { return( testdir ); } const string& root() const { return( rootprefix ); } string prependRoot(const string& mp) const; - const string& tmpDir() const; + const string& tmpDir() const { return tempdir; } bool efiBoot() const { return efiboot; } static const string& arch() { return( proc_arch ); } static bool isPPCMac() { return( is_ppc_mac ); } Modified: trunk/storage/libstorage/src/Volume.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Volume.cc?... ============================================================================== --- trunk/storage/libstorage/src/Volume.cc (original) +++ trunk/storage/libstorage/src/Volume.cc Fri May 22 11:18:58 2009 @@ -1291,7 +1291,6 @@ if( needrmdir ) { rmdir( mpoint.c_str() ); - rmdir( cont->getStorage()->tmpDir().c_str() ); } } break; @@ -1749,7 +1748,6 @@ } unlink( fname.c_str() ); rmdir( mpname.c_str() ); - rmdir( cont->getStorage()->tmpDir().c_str() ); y2mil("ret:" << encTypeString(ret)); return( ret ); } @@ -1790,7 +1788,6 @@ if( !fname.empty() ) { unlink( fname.c_str() ); - rmdir( cont->getStorage()->tmpDir().c_str() ); } Storage::waitForDevice(loop_dev); } @@ -1913,7 +1910,6 @@ } } unlink( fname.c_str() ); - rmdir( cont->getStorage()->tmpDir().c_str() ); Storage::waitForDevice(dmcrypt_dev); } if( ret==0 ) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
aschnell@svn.opensuse.org