1
0
MozillaFirefox/mozilla-bmo1233434.patch

46 lines
1.4 KiB
Diff
Raw Normal View History

# HG changeset patch
# User Aidin Gharibnavaz <aidin@aidinhut.com>
# Date 1450550460 -12600
# Node ID 07ec362866977f37e638fc88e3079621fd7aef96
# Parent cb66ffeb6725e8344818e8e2f707ae2eaeb953b4
Bug 1233434 - Fixing download failure on a multi-user GNU/Linux machine. r?bagder
diff -r cb66ffeb6725 -r 07ec36286697 uriloader/exthandler/nsExternalHelperAppService.cpp
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp Tue Dec 15 14:45:06 2015 +0100
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp Sat Dec 19 22:11:00 2015 +0330
@@ -416,12 +416,12 @@
const char* userName = PR_GetEnv("USERNAME");
if (!userName || !*userName) {
userName = PR_GetEnv("USER");
- if (!userName || !*userName) {
- userName = PR_GetEnv("LOGNAME");
- }
- else {
- userName = "mozillaUser";
- }
+ }
+ if (!userName || !*userName) {
+ userName = PR_GetEnv("LOGNAME");
+ }
+ if (!userName || !*userName) {
+ userName = "mozillaUser";
}
nsAutoString userDir;
@@ -447,7 +447,12 @@
rv = finalPath->GetPermissions(&permissions);
NS_ENSURE_SUCCESS(rv, rv);
- if (permissions == PR_IRWXU) {
+ // Ensuring the path is writable by the current user.
+ bool isWritable;
+ rv = finalPath->IsWritable(&isWritable);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ if (permissions == PR_IRWXU && isWritable) {
dir = finalPath;
break;
}