diff options
author | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-25 17:35:54 +0000 |
---|---|---|
committer | davemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-25 17:35:54 +0000 |
commit | c4185460ea68a358320cca15cbe836e9dfb55138 (patch) | |
tree | 7081280be5a6949408c9414968257d8ba90c1596 /dbus | |
parent | 8432c3eadc8d5495736255408f60744a43b2266d (diff) | |
download | chromium_src-c4185460ea68a358320cca15cbe836e9dfb55138.zip chromium_src-c4185460ea68a358320cca15cbe836e9dfb55138.tar.gz chromium_src-c4185460ea68a358320cca15cbe836e9dfb55138.tar.bz2 |
Revert 148351 - Make dbus file descriptor check dynamic
Without this change cros builds from outside the chroot can't run
tracing code.
BUG=None
TEST=None
Review URL: https://chromiumcodereview.appspot.com/10815083
TBR=davemoore@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10822016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148353 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'dbus')
-rw-r--r-- | dbus/message.cc | 27 | ||||
-rw-r--r-- | dbus/message.h | 5 |
2 files changed, 13 insertions, 19 deletions
diff --git a/dbus/message.cc b/dbus/message.cc index 7a1db05..fd7c077 100644 --- a/dbus/message.cc +++ b/dbus/message.cc @@ -18,9 +18,9 @@ namespace { // Appends the header name and the value to |output|, if the value is // not empty. -void AppendStringHeader(const std::string& header_name, - const std::string& header_value, - std::string* output) { +static void AppendStringHeader(const std::string& header_name, + const std::string& header_value, + std::string* output) { if (!header_value.empty()) { *output += header_name + ": " + header_value + "\n"; } @@ -28,24 +28,15 @@ void AppendStringHeader(const std::string& header_name, // Appends the header name and the value to |output|, if the value is // nonzero. -void AppendUint32Header(const std::string& header_name, - uint32 header_value, - std::string* output) { +static void AppendUint32Header(const std::string& header_name, + uint32 header_value, + std::string* output) { if (header_value != 0) { *output += (header_name + ": " + base::StringPrintf("%u", header_value) + "\n"); } } -// Returns true if Unix FD passing is supported in libdbus. -// The check is done runtime rather than compile time as the libdbus -// version used at runtime may be different from the one used at compile time. -bool IsDBusTypeUnixFdSupported() { - int major = 0, minor = 0, micro = 0; - dbus_get_version(&major, &minor, µ); - return major >= 1 && minor >= 4; -} - } // namespace namespace dbus { @@ -220,7 +211,7 @@ std::string Message::ToStringInternal(const std::string& indent, break; } case UNIX_FD: { - CHECK(IsDBusTypeUnixFdSupported()); + CHECK(kDBusTypeUnixFdIsSupported); FileDescriptor file_descriptor; if (!reader->PopFileDescriptor(&file_descriptor)) @@ -699,7 +690,7 @@ void MessageWriter::AppendVariantOfBasic(int dbus_type, const void* value) { } void MessageWriter::AppendFileDescriptor(const FileDescriptor& value) { - CHECK(IsDBusTypeUnixFdSupported()); + CHECK(kDBusTypeUnixFdIsSupported); if (!value.is_valid()) { // NB: sending a directory potentially enables sandbox escape @@ -969,7 +960,7 @@ bool MessageReader::PopVariantOfBasic(int dbus_type, void* value) { } bool MessageReader::PopFileDescriptor(FileDescriptor* value) { - CHECK(IsDBusTypeUnixFdSupported()); + CHECK(kDBusTypeUnixFdIsSupported); int fd = -1; const bool success = PopBasic(DBUS_TYPE_UNIX_FD, &fd); diff --git a/dbus/message.h b/dbus/message.h index e0845de..4d32cb9 100644 --- a/dbus/message.h +++ b/dbus/message.h @@ -28,7 +28,10 @@ class MessageWriter; class MessageReader; // DBUS_TYPE_UNIX_FD was added in D-Bus version 1.4 -#if !defined(DBUS_TYPE_UNIX_FD) +#if defined(DBUS_TYPE_UNIX_FD) +const bool kDBusTypeUnixFdIsSupported = true; +#else +const bool kDBusTypeUnixFdIsSupported = false; #define DBUS_TYPE_UNIX_FD ((int) 'h') #endif |