Index: chrome/browser/shell_integration_linux.cc |
diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc |
index 905b23f07ced48adc233d82a5a8190acd653fcec..ef8f9b9272ab5bbc80e838192491df510e943170 100644 |
--- a/chrome/browser/shell_integration_linux.cc |
+++ b/chrome/browser/shell_integration_linux.cc |
@@ -163,12 +163,7 @@ bool CreateShortcutOnDesktop(const base::FilePath& shortcut_filename, |
return false; |
} |
- ssize_t bytes_written = base::WriteFileDescriptor(fd, contents.data(), |
- contents.length()); |
- if (IGNORE_EINTR(close(fd)) < 0) |
- PLOG(ERROR) << "close"; |
- |
- if (bytes_written != static_cast<ssize_t>(contents.length())) { |
+ if (!base::WriteFileDescriptor(fd, contents.c_str(), contents.size())) { |
// Delete the file. No shortuct is better than corrupted one. Use unlinkat |
// 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 |
@@ -176,6 +171,9 @@ bool CreateShortcutOnDesktop(const base::FilePath& shortcut_filename, |
unlinkat(desktop_fd, shortcut_filename.value().c_str(), 0); |
} |
+ if (IGNORE_EINTR(close(fd)) < 0) |
+ PLOG(ERROR) << "close"; |
+ |
if (IGNORE_EINTR(close(desktop_fd)) < 0) |
PLOG(ERROR) << "close"; |