Commits

Michał Górny  committed 9ead1e5

Add 'saveuid' parameter to SmartLiveRebuild() to avoid setuid() in emerge.

  • Participants
  • Parent commits f2bb5ff

Comments (0)

Files changed (2)

File SmartLiveRebuild/core.py

 class SLRFailure(Exception):
 	pass
 
-def SmartLiveRebuild(opts, db = None):
+def SmartLiveRebuild(opts, db = None, saveuid = False):
 	if not opts.color:
 		out.monochromize()
 
 					if opts.quickpkg:
 						out.err("Running as the portage user, --quickpkg probably won't work")
 					userok = True
-			elif opts.pretend and not opts.quickpkg:
+			elif opts.pretend and not opts.quickpkg and not saveuid:
 				out.s1('Dropping superuser privileges ...')
 				os.setuid(puid)
 			else:

File SmartLiveRebuild/sets.py

 	description = "Package set containing live packages awaiting update"
 
 	def __init__(self, opts, dbapi, settings):
-		# required in order to force fork() before setuid()
-		opts.pretend = False
+		opts.pretend = True
 
 		self._options = opts
 		self._dbapi = dbapi
 	def load(self):
 		try:
 			packages = SmartLiveRebuild(self._options,
-					db = self._dbapi)
+					db = self._dbapi, saveuid = True)
 		except SLRFailure:
 			pass
 		else: