Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / shell_integration_linux.cc
index a521610..ef8f9b9 100644 (file)
@@ -21,9 +21,9 @@
 #include "base/base_paths.h"
 #include "base/command_line.h"
 #include "base/environment.h"
-#include "base/file_util.h"
 #include "base/files/file_enumerator.h"
 #include "base/files/file_path.h"
+#include "base/files/file_util.h"
 #include "base/files/scoped_temp_dir.h"
 #include "base/i18n/file_util_icu.h"
 #include "base/memory/ref_counted_memory.h"
@@ -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";