From: Zac Medico Date: Sat, 23 Dec 2006 04:06:50 +0000 (-0000) Subject: Only write repo.stats and repo.fails when the repoman user has write access to /var... X-Git-Tag: v2.1.2~237 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7a574fa6273334ea7a76b4c7b4fa9a908310f72b;p=portage.git Only write repo.stats and repo.fails when the repoman user has write access to /var/cache/edb. svn path=/main/trunk/; revision=5360 --- diff --git a/bin/repoman b/bin/repoman index adb9e6b83..0cc74f426 100755 --- a/bin/repoman +++ b/bin/repoman @@ -1371,18 +1371,14 @@ for x in scanlist: fails["ebuild.allmasked"].append(x) #Pickle and save results for instant reuse in last and lfull -savef=open('/var/cache/edb/repo.stats','w') -pickle.dump(stats,savef) -savef.close() -savef=open('/var/cache/edb/repo.fails','w') -pickle.dump(fails,savef) -savef.close() -if not (os.stat('/var/cache/edb/repo.stats')[ST_GID] == getgrnam('portage')[2]): - os.chown('/var/cache/edb/repo.stats',os.geteuid(),getgrnam('portage')[2]) - os.chmod('/var/cache/edb/repo.stats',0664) -if not (os.stat('/var/cache/edb/repo.fails')[ST_GID] == getgrnam('portage')[2]): - os.chown('/var/cache/edb/repo.fails',os.geteuid(),getgrnam('portage')[2]) - os.chmod('/var/cache/edb/repo.fails',0664) +if os.access(portage_const.CACHE_PATH, os.W_OK): + for myobj, fname in (stats, "repo.stats"), (fails, "repo.fails"): + fpath = os.path.join(portage_const.CACHE_PATH, fname) + savef = open(fpath, 'w') + pickle.dump(myobj, savef) + savef.close() + portage.apply_secpass_permissions(fpath, gid=portage.portage_gid, + mode=0664) if quiet < 2: print #dofail will be set to 1 if we have failed in at least one non-warning category