summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-17 02:01:44 +0000
committerdmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-17 02:01:44 +0000
commit83a307f4d6399f27d323a96b6b112e65b06e63ab (patch)
tree80627b8902c5c15c558f89a363fbaccc33f4014e
parent9cc81a9081d91cf6e64ea995707ed739a8a98efb (diff)
downloadchromium_src-83a307f4d6399f27d323a96b6b112e65b06e63ab.zip
chromium_src-83a307f4d6399f27d323a96b6b112e65b06e63ab.tar.gz
chromium_src-83a307f4d6399f27d323a96b6b112e65b06e63ab.tar.bz2
Fix up clang build, and presubmit warnings about strcpy.
Also fixes typo in comment. BUG=none TEST=build Review URL: http://codereview.chromium.org/5100001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66364 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/common/multi_process_lock_linux.cc18
-rw-r--r--chrome/common/multi_process_lock_unittest.cc2
2 files changed, 16 insertions, 4 deletions
diff --git a/chrome/common/multi_process_lock_linux.cc b/chrome/common/multi_process_lock_linux.cc
index 0a83c89..d2d3da3 100644
--- a/chrome/common/multi_process_lock_linux.cc
+++ b/chrome/common/multi_process_lock_linux.cc
@@ -43,7 +43,15 @@ class MultiProcessLockLinux : public MultiProcessLock {
== MULTI_PROCESS_LOCK_NAME_MAX_LEN + 2, sun_path_size_changed);
memset(&address, 0, sizeof(address));
- strcpy(&address.sun_path[1], name_.c_str());
+ int print_length = snprintf(&address.sun_path[1],
+ MULTI_PROCESS_LOCK_NAME_MAX_LEN + 1,
+ "%s", name_.c_str());
+
+ if (print_length < 0 ||
+ print_length > static_cast<int>(MULTI_PROCESS_LOCK_NAME_MAX_LEN)) {
+ PLOG(ERROR) << "Couldn't create sun_path - " << name_;
+ return false;
+ }
// Must set the first character of the path to something non-zero
// before we call SUN_LEN which depends on strcpy working.
@@ -70,7 +78,9 @@ class MultiProcessLockLinux : public MultiProcessLock {
PLOG(ERROR) << "Couldn't bind socket - "
<< &(address.sun_path[1])
<< " Length: " << length;
- HANDLE_EINTR(close(socket_fd));
+ if (HANDLE_EINTR(close(socket_fd)) < 0) {
+ PLOG(ERROR) << "close";
+ }
return false;
}
}
@@ -80,7 +90,9 @@ class MultiProcessLockLinux : public MultiProcessLock {
DLOG(ERROR) << "Over-unlocked MultiProcessLock - " << name_;
return;
}
- HANDLE_EINTR(close(fd_));
+ if (HANDLE_EINTR(close(fd_)) < 0) {
+ PLOG(ERROR) << "close";
+ }
fd_ = -1;
}
diff --git a/chrome/common/multi_process_lock_unittest.cc b/chrome/common/multi_process_lock_unittest.cc
index 733eb2d..d408db7 100644
--- a/chrome/common/multi_process_lock_unittest.cc
+++ b/chrome/common/multi_process_lock_unittest.cc
@@ -134,7 +134,7 @@ MULTIPROCESS_TEST_MAIN(MultiProcessLockTryFailMain) {
#if defined(OS_MACOSX)
// OS X sends out a log if a lock fails.
// Hopefully this will keep people from panicking about it when they
- // are perusing thge build logs.
+ // are perusing the build logs.
LOG(INFO) << "Following error log "
<< "\"CFMessagePort: bootstrap_register(): failed 1100 (0x44c) "
<< "'Permission denied'\" is expected";