2011-05-27 15:23:09 +02:00
|
|
|
$NetBSD: patch-chrome_browser_shell__integration__linux.cc,v 1.2 2011/05/27 13:23:09 rxg Exp $
|
2010-11-27 02:24:39 +01:00
|
|
|
|
2011-05-27 15:23:09 +02:00
|
|
|
--- chrome/browser/shell_integration_linux.cc.orig 2011-05-24 08:01:43.000000000 +0000
|
2010-11-27 02:24:39 +01:00
|
|
|
+++ chrome/browser/shell_integration_linux.cc
|
2011-04-28 05:09:01 +02:00
|
|
|
@@ -117,11 +117,23 @@ void CreateShortcutOnDesktop(const FileP
|
2010-11-27 02:24:39 +01:00
|
|
|
if (!PathService::Get(chrome::DIR_USER_DESKTOP, &desktop_path))
|
|
|
|
return;
|
|
|
|
|
2011-05-27 15:23:09 +02:00
|
|
|
+#if defined(OS_BSD)
|
2010-11-27 02:24:39 +01:00
|
|
|
+ int desktop_fd = open(desktop_path.value().c_str(), O_RDONLY);
|
|
|
|
+#else
|
|
|
|
int desktop_fd = open(desktop_path.value().c_str(), O_RDONLY | O_DIRECTORY);
|
|
|
|
+#endif
|
|
|
|
if (desktop_fd < 0)
|
|
|
|
return;
|
|
|
|
|
2011-04-28 05:09:01 +02:00
|
|
|
+#if defined(OS_BSD)
|
2010-11-27 02:24:39 +01:00
|
|
|
+ const char* path = shortcut_filename.value().c_str();
|
|
|
|
+ if (path[0] != '/')
|
|
|
|
+ path = strcat((char*)desktop_path.value().c_str(), path);
|
|
|
|
+
|
|
|
|
+ int fd = open(path,
|
|
|
|
+#else
|
|
|
|
int fd = openat(desktop_fd, shortcut_filename.value().c_str(),
|
|
|
|
+#endif
|
|
|
|
O_CREAT | O_EXCL | O_WRONLY,
|
|
|
|
S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
|
|
|
|
if (fd < 0) {
|
2011-04-28 05:09:01 +02:00
|
|
|
@@ -140,7 +152,15 @@ void CreateShortcutOnDesktop(const FileP
|
2010-11-27 02:24:39 +01:00
|
|
|
// to make sure we're deleting the file in the directory we think we are.
|
|
|
|
// Even if an attacker manager to put something other at
|
|
|
|
// |shortcut_filename| we'll just undo his action.
|
2011-04-28 05:09:01 +02:00
|
|
|
+#if defined(OS_BSD)
|
2010-11-27 02:24:39 +01:00
|
|
|
+ path = shortcut_filename.value().c_str();
|
|
|
|
+ if (path[0] != '/')
|
|
|
|
+ path = strcat((char*)desktop_path.value().c_str(), path);
|
|
|
|
+
|
|
|
|
+ unlink(path);
|
|
|
|
+#else
|
|
|
|
unlinkat(desktop_fd, shortcut_filename.value().c_str(), 0);
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
if (HANDLE_EINTR(close(desktop_fd)) < 0)
|