Better cache locking semantics
This commit is contained in:
parent
510a48ecb3
commit
3f5a452133
@ -201,12 +201,6 @@ PCache *pkg_cache_create() {
|
||||
#else
|
||||
const char *to_c_string(std::string s);
|
||||
|
||||
#include <unistd.h>
|
||||
bool can_commit() {
|
||||
// Allow user with effective SU to acquire lock
|
||||
return geteuid() == 0;
|
||||
}
|
||||
|
||||
|
||||
// See ALT's apt/cmdline
|
||||
// Used to print out the progress
|
||||
@ -214,12 +208,9 @@ bool can_commit() {
|
||||
ostream progress_stream(0);
|
||||
|
||||
PCache *pkg_cache_create() {
|
||||
// Maybe should be set to false sometimes
|
||||
// (Set to can_commit() for now)
|
||||
// We should lock for installation, etc.
|
||||
// For read-only access no locking needed
|
||||
// In apt-shell, WithLock is always set according to (geteuid() == 0).
|
||||
const bool WithLock = can_commit();
|
||||
const bool WithLock = false;
|
||||
|
||||
CacheFile *cache_file = new CacheFile(progress_stream, WithLock);
|
||||
cache_file->Open();
|
||||
|
Loading…
Reference in New Issue
Block a user