From dc8043f74ef0056addfb0675a6e6640fbab3fad6 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Thu, 6 Oct 2011 19:27:35 +0200 Subject: [PATCH] [entropy.db] EntropyRepository.readonly(): if uid == 0, override os.access() check --- libraries/entropy/db/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libraries/entropy/db/__init__.py b/libraries/entropy/db/__init__.py index 0af41a64a..de8521768 100644 --- a/libraries/entropy/db/__init__.py +++ b/libraries/entropy/db/__init__.py @@ -578,10 +578,11 @@ class EntropyRepository(EntropyRepositoryBase): Reimplemented from EntropyRepositoryBase. """ if (not self._readonly) and (self._db_path != ":memory:"): - # make sure that user can write to file - # before returning False, override actual - # readonly status - return not os.access(self._db_path, os.W_OK) + if os.getuid() != 0: + # make sure that user can write to file + # before returning False, override actual + # readonly status + return not os.access(self._db_path, os.W_OK) return self._readonly def setIndexing(self, indexing):