Fix compilation with clang.
git-svn-id: http://libjingle.googlecode.com/svn/trunk@71 dd674b97-3498-5ee5-1854-bdd07cd0ff33
diff --git a/talk/base/linux.cc b/talk/base/linux.cc
index ba80ff5..9303f4f 100644
--- a/talk/base/linux.cc
+++ b/talk/base/linux.cc
@@ -272,7 +272,7 @@
}
// No cached result. Run lsb_release and parse output.
POpenStream lsb_release_output;
- if (!lsb_release_output.Open("lsb_release -idrcs", "r")) {
+ if (!lsb_release_output.Open("lsb_release -idrcs", "r", NULL)) {
LOG_ERR(LS_ERROR) << "Can't run lsb_release";
return lsb_release_string; // empty
}
diff --git a/talk/base/stream.cc b/talk/base/stream.cc
index cdd6098..25dce7b 100644
--- a/talk/base/stream.cc
+++ b/talk/base/stream.cc
@@ -543,15 +543,22 @@
POpenStream::Close();
}
-bool POpenStream::Open(const std::string& subcommand, const char* mode) {
+bool POpenStream::Open(const std::string& subcommand,
+ const char* mode,
+ int *error) {
Close();
file_ = popen(subcommand.c_str(), mode);
- return file_ != NULL;
+ if (file_ == NULL) {
+ if (error)
+ *error = errno;
+ return false;
+ }
+ return true;
}
bool POpenStream::OpenShare(const std::string& subcommand, const char* mode,
- int shflag) {
- return Open(subcommand, mode);
+ int shflag, int* error) {
+ return Open(subcommand, mode, error);
}
void POpenStream::DoClose() {
diff --git a/talk/base/stream.h b/talk/base/stream.h
index 496b4ce..37fcae7 100644
--- a/talk/base/stream.h
+++ b/talk/base/stream.h
@@ -460,10 +460,11 @@
POpenStream() : wait_status_(-1) {}
virtual ~POpenStream();
- virtual bool Open(const std::string& subcommand, const char* mode);
+ virtual bool Open(const std::string& subcommand, const char* mode,
+ int* error);
// Same as Open(). shflag is ignored.
virtual bool OpenShare(const std::string& subcommand, const char* mode,
- int shflag);
+ int shflag, int* error);
// Returns the wait status from the last Close() of an Open()'ed stream, or
// -1 if no Open()+Close() has been done on this object. Meaning of the number