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

Unified Diff: dbus/message.cc

Issue 2337893002: dbus: Remove dbus::FileDescriptor (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dbus/message.h ('k') | dbus/message_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dbus/message.cc
diff --git a/dbus/message.cc b/dbus/message.cc
index 43e88e2286ad498fb99fa54dc939c858e7a67c69..c8663f72ad682ce21c4339d09971a8869eed829b 100644
--- a/dbus/message.cc
+++ b/dbus/message.cc
@@ -222,11 +222,11 @@ std::string Message::ToStringInternal(const std::string& indent,
case UNIX_FD: {
CHECK(IsDBusTypeUnixFdSupported());
- FileDescriptor file_descriptor;
+ base::ScopedFD file_descriptor;
if (!reader->PopFileDescriptor(&file_descriptor))
return kBrokenMessage;
output += indent + "fd#" +
- base::IntToString(file_descriptor.value()) + "\n";
+ base::IntToString(file_descriptor.get()) + "\n";
break;
}
default:
@@ -719,17 +719,6 @@ void MessageWriter::AppendFileDescriptor(int value) {
AppendBasic(DBUS_TYPE_UNIX_FD, &value); // This duplicates the FD.
}
-void MessageWriter::AppendFileDescriptor(const FileDescriptor& value) {
- CHECK(IsDBusTypeUnixFdSupported());
-
- if (!value.is_valid()) {
- // NB: sending a directory potentially enables sandbox escape
- LOG(FATAL) << "Attempt to pass invalid file descriptor";
- }
- int fd = value.value();
- AppendBasic(DBUS_TYPE_UNIX_FD, &fd);
-}
-
//
// MessageReader implementation.
//
@@ -1033,17 +1022,4 @@ bool MessageReader::PopFileDescriptor(base::ScopedFD* value) {
return true;
}
-bool MessageReader::PopFileDescriptor(FileDescriptor* value) {
- CHECK(IsDBusTypeUnixFdSupported());
-
- int fd = -1;
- const bool success = PopBasic(DBUS_TYPE_UNIX_FD, &fd);
- if (!success)
- return false;
-
- value->PutValue(fd);
- // NB: the caller must check validity before using the value
- return true;
-}
-
} // namespace dbus
« no previous file with comments | « dbus/message.h ('k') | dbus/message_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698