OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/shell_integration_linux.h" | 5 #include "chrome/browser/shell_integration_linux.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 if (fd < 0) { | 327 if (fd < 0) { |
328 if (IGNORE_EINTR(close(desktop_fd)) < 0) | 328 if (IGNORE_EINTR(close(desktop_fd)) < 0) |
329 PLOG(ERROR) << "close"; | 329 PLOG(ERROR) << "close"; |
330 return false; | 330 return false; |
331 } | 331 } |
332 | 332 |
333 if (!base::WriteFileDescriptor(fd, contents.c_str(), contents.size())) { | 333 if (!base::WriteFileDescriptor(fd, contents.c_str(), contents.size())) { |
334 // Delete the file. No shortuct is better than corrupted one. Use unlinkat | 334 // Delete the file. No shortuct is better than corrupted one. Use unlinkat |
335 // to make sure we're deleting the file in the directory we think we are. | 335 // to make sure we're deleting the file in the directory we think we are. |
336 // Even if an attacker manager to put something other at | 336 // Even if an attacker manager to put something other at |
337 // |shortcut_filename| we'll just undo his action. | 337 // |shortcut_filename| we'll just undo their action. |
338 unlinkat(desktop_fd, shortcut_filename.value().c_str(), 0); | 338 unlinkat(desktop_fd, shortcut_filename.value().c_str(), 0); |
339 } | 339 } |
340 | 340 |
341 if (IGNORE_EINTR(close(fd)) < 0) | 341 if (IGNORE_EINTR(close(fd)) < 0) |
342 PLOG(ERROR) << "close"; | 342 PLOG(ERROR) << "close"; |
343 | 343 |
344 if (IGNORE_EINTR(close(desktop_fd)) < 0) | 344 if (IGNORE_EINTR(close(desktop_fd)) < 0) |
345 PLOG(ERROR) << "close"; | 345 PLOG(ERROR) << "close"; |
346 | 346 |
347 return true; | 347 return true; |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1048 base::FilePath applications_menu = GetDataWriteLocation(env.get()); | 1048 base::FilePath applications_menu = GetDataWriteLocation(env.get()); |
1049 applications_menu = applications_menu.AppendASCII("applications"); | 1049 applications_menu = applications_menu.AppendASCII("applications"); |
1050 std::vector<base::FilePath> shortcut_filenames_app_menu = | 1050 std::vector<base::FilePath> shortcut_filenames_app_menu = |
1051 GetExistingProfileShortcutFilenames(profile_path, applications_menu); | 1051 GetExistingProfileShortcutFilenames(profile_path, applications_menu); |
1052 for (const auto& menu : shortcut_filenames_app_menu) { | 1052 for (const auto& menu : shortcut_filenames_app_menu) { |
1053 DeleteShortcutInApplicationsMenu(menu, base::FilePath(kDirectoryFilename)); | 1053 DeleteShortcutInApplicationsMenu(menu, base::FilePath(kDirectoryFilename)); |
1054 } | 1054 } |
1055 } | 1055 } |
1056 | 1056 |
1057 } // namespace shell_integration_linux | 1057 } // namespace shell_integration_linux |
OLD | NEW |