|
a/src/utils/circache.cpp |
|
b/src/utils/circache.cpp |
|
... |
|
... |
1328 |
using namespace std;
|
1328 |
using namespace std;
|
1329 |
|
1329 |
|
1330 |
|
1330 |
|
1331 |
bool resizecc(const string& dir, int newmbs)
|
1331 |
bool resizecc(const string& dir, int newmbs)
|
1332 |
{
|
1332 |
{
|
1333 |
RefCntr<CirCache> occ(new CirCache(dir));
|
1333 |
STD_SHARED_PTR<CirCache> occ(new CirCache(dir));
|
1334 |
string ofn = occ->getpath();
|
1334 |
string ofn = occ->getpath();
|
1335 |
|
1335 |
|
1336 |
string backupfn = ofn + ".orig";
|
1336 |
string backupfn = ofn + ".orig";
|
1337 |
if (access(backupfn.c_str(), 0) >= 0) {
|
1337 |
if (access(backupfn.c_str(), 0) >= 0) {
|
1338 |
cerr << "Backup file " << backupfn <<
|
1338 |
cerr << "Backup file " << backupfn <<
|
|
... |
|
... |
1351 |
perror("mkdir");
|
1351 |
perror("mkdir");
|
1352 |
return false;
|
1352 |
return false;
|
1353 |
}
|
1353 |
}
|
1354 |
}
|
1354 |
}
|
1355 |
|
1355 |
|
1356 |
RefCntr<CirCache> ncc(new CirCache(tmpdir));
|
1356 |
STD_SHARED_PTR<CirCache> ncc(new CirCache(tmpdir));
|
1357 |
string nfn = ncc->getpath();
|
1357 |
string nfn = ncc->getpath();
|
1358 |
if (!ncc->create(off_t(newmbs) * 1000 * 1024,
|
1358 |
if (!ncc->create(off_t(newmbs) * 1000 * 1024,
|
1359 |
CirCache::CC_CRUNIQUE | CirCache::CC_CRTRUNCATE)) {
|
1359 |
CirCache::CC_CRUNIQUE | CirCache::CC_CRTRUNCATE)) {
|
1360 |
cerr << "Cant create new file in " << tmpdir << " : " <<
|
1360 |
cerr << "Cant create new file in " << tmpdir << " : " <<
|
1361 |
ncc->getReason() << endl;
|
1361 |
ncc->getReason() << endl;
|