summaryrefslogtreecommitdiffstats
path: root/chrome/browser/shell_integration_linux.cc
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-16 23:00:15 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-16 23:00:15 +0000
commit19cb929fa737ae5ef3c1425d38a793ef8967ee00 (patch)
tree84801b2724d970541aa86f8a81d1f4b0c1d89ff6 /chrome/browser/shell_integration_linux.cc
parentb3c064c2338e88a6ecfef7454bc3301d643a91fe (diff)
downloadchromium_src-19cb929fa737ae5ef3c1425d38a793ef8967ee00.zip
chromium_src-19cb929fa737ae5ef3c1425d38a793ef8967ee00.tar.gz
chromium_src-19cb929fa737ae5ef3c1425d38a793ef8967ee00.tar.bz2
posix: handle the return value of close() in more places.
Generally, we don't expect it to fail and there isn't much we can do anyway, but it's good to at least consider each case and do something so we can continue to receive warnings in situations where we forgot to check the return code. (Bonus extra bugfix: use int where we previously had bool. I think it compiles to the same thing but the old code was definitely wrong.) Review URL: http://codereview.chromium.org/1564037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44844 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/shell_integration_linux.cc')
-rw-r--r--chrome/browser/shell_integration_linux.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc
index 19d1730..3c87350 100644
--- a/chrome/browser/shell_integration_linux.cc
+++ b/chrome/browser/shell_integration_linux.cc
@@ -139,13 +139,15 @@ void CreateShortcutOnDesktop(const FilePath& shortcut_filename,
O_CREAT | O_EXCL | O_WRONLY,
S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
if (fd < 0) {
- HANDLE_EINTR(close(desktop_fd));
+ if (HANDLE_EINTR(close(desktop_fd)) < 0)
+ PLOG(ERROR) << "close";
return;
}
ssize_t bytes_written = file_util::WriteFileDescriptor(fd, contents.data(),
contents.length());
- HANDLE_EINTR(close(fd));
+ if (HANDLE_EINTR(close(fd)) < 0)
+ PLOG(ERROR) << "close";
if (bytes_written != static_cast<ssize_t>(contents.length())) {
// Delete the file. No shortuct is better than corrupted one. Use unlinkat
@@ -155,7 +157,8 @@ void CreateShortcutOnDesktop(const FilePath& shortcut_filename,
unlinkat(desktop_fd, shortcut_filename.value().c_str(), 0);
}
- HANDLE_EINTR(close(desktop_fd));
+ if (HANDLE_EINTR(close(desktop_fd)) < 0)
+ PLOG(ERROR) << "close";
}
void CreateShortcutInApplicationsMenu(const FilePath& shortcut_filename,