From fe78f13ec86ea67903357370a0899752e035decc Mon Sep 17 00:00:00 2001 From: "darin%meer.net" Date: Fri, 21 Oct 2005 18:17:02 +0000 Subject: [PATCH] fixes bug 313240 "Update service fails via exception when run as non-privileged user" patch by Ben Turner (bent.mozilla@gmail.com), r=darin git-svn-id: svn://10.0.0.236/trunk@182721 18797224-902f-48f8-a5cc-f745e15eee43 --- .../toolkit/mozapps/update/src/nsUpdateService.js.in | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mozilla/toolkit/mozapps/update/src/nsUpdateService.js.in b/mozilla/toolkit/mozapps/update/src/nsUpdateService.js.in index f1f72a7cf40..bd2f2b3f67a 100644 --- a/mozilla/toolkit/mozapps/update/src/nsUpdateService.js.in +++ b/mozilla/toolkit/mozapps/update/src/nsUpdateService.js.in @@ -330,8 +330,11 @@ function writeStatusFile(dir, state) { * Removes the Updates Directory */ function cleanUpUpdatesDir() { + // Bail out if we don't have appropriate permissions + if (!this.canUpdate) + return; + var updateDir = getUpdatesDir(); - var e = updateDir.directoryEntries; while (e.hasMoreElements()) { var f = e.getNext().QueryInterface(Components.interfaces.nsIFile); @@ -922,6 +925,11 @@ UpdateService.prototype = { */ _postUpdateProcessing: function() { // Detect installation failures and notify + + // Bail out if we don't have appropriate permissions + if (!this.canUpdate) + return; + var status = readStatusFile(getUpdatesDir()); if (status == STATE_DOWNLOADING) { LOG("UpdateService", "_postUpdateProcessing: Downloading patch, resuming...");