Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Issue 7743001: There are times on the Mac when pipe names of 0 length may occur. Let the caller handle (Closed)

Created:
9 years, 4 months ago by dmac
Modified:
9 years, 4 months ago
Reviewers:
Mark Mentovai, agl, jeremy
CC:
chromium-reviews, darin-cc_chromium.org, jam, Paweł Hajdan Jr.
Visibility:
Public.

Description

There are times on the Mac when pipe names of 0 length may occur. Let the caller handle the error instead of aborting here. BUG=75518 TEST=BUILD Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=98225

Patch Set 1 #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+20 lines, -3 lines) Patch
M ipc/ipc_channel_posix.cc View 2 chunks +1 line, -3 lines 0 comments Download
M ipc/ipc_channel_posix_unittest.cc View 1 chunk +19 lines, -0 lines 3 comments Download

Messages

Total messages: 4 (0 generated)
dmac
If one of you could PTAL I'd appreciate it. Should be pretty quick.
9 years, 4 months ago (2011-08-24 22:20:04 UTC) #1
agl
LGTM
9 years, 4 months ago (2011-08-24 22:23:03 UTC) #2
jeremy
LGTM http://codereview.chromium.org/7743001/diff/1/ipc/ipc_channel_posix_unittest.cc File ipc/ipc_channel_posix_unittest.cc (right): http://codereview.chromium.org/7743001/diff/1/ipc/ipc_channel_posix_unittest.cc#newcode298 ipc/ipc_channel_posix_unittest.cc:298: "leading-edge_processes"); _with_a_cherry_on_top :o)
9 years, 4 months ago (2011-08-25 07:16:51 UTC) #3
Mark Mentovai
9 years, 4 months ago (2011-08-25 13:11:02 UTC) #4
LG otherwise

http://codereview.chromium.org/7743001/diff/1/ipc/ipc_channel_posix_unittest.cc
File ipc/ipc_channel_posix_unittest.cc (right):

http://codereview.chromium.org/7743001/diff/1/ipc/ipc_channel_posix_unittest....
ipc/ipc_channel_posix_unittest.cc:291: IPC::ChannelHandle
handle2("This_is_a_very_long_name_that_must_be_more_than"
Do “const char kTooLongName[] =
This_is_a_very_long_name_that_must_be_more_than"…” and then
EXPECT_GE(strlen(kTooLongName), IPC::kMaxPipeNameLength).

Since we expect the buffer size on Linux to be 108 but cap it at 104 anyway (see
ipc_channel_posix.h), you may also want to EXPECT_LT(strlen(kTooLongName), 108)
to ensure that we’re testing the right thing on Linux to. If you don’t like
hardcoding 108, you can do:

  if (sizeof(((sockaddr_un*)0)->sun_path) > IPC::kMaxPipeNameLength)
    EXPECT_LT(strlen(kTooLongName), sizeof(((sockaddr_un*)0)->sun_path));

http://codereview.chromium.org/7743001/diff/1/ipc/ipc_channel_posix_unittest....
ipc/ipc_channel_posix_unittest.cc:300: ASSERT_FALSE(channel2.Connect());
Note that the suggested size checks could be ASSERT instead of EXPECT, but I
think that the Connect() checks should be EXPECT instead of ASSERT.

Powered by Google App Engine
This is Rietveld 408576698