gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnash-commit] Detect and log error if dup(0) fail in StreamProvider


From: Bastiaan Jacques
Subject: Re: [Gnash-commit] Detect and log error if dup(0) fail in StreamProvider::getStream() (Coverity CID 1149170).
Date: Thu, 24 Apr 2014 21:57:30 +0200 (CEST)
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)

diff --git a/libbase/StreamProvider.cpp b/libbase/StreamProvider.cpp
index 0e3efb3..8204089 100644
--- a/libbase/StreamProvider.cpp
+++ b/libbase/StreamProvider.cpp
@@ -69,7 +69,13 @@ StreamProvider::getStream(const URL& url, bool 
namedCacheFile) const
             //       Note also that the FB gui will use stdin
             //       for key events.
             //
-                       FILE *newin = fdopen(dup(0), "rb");
+                       int fd = dup(0);
+                       if (0 > fd) {
+                               log_error(_("Could not stdin (filename -): 
%2%"),
+                                         std::strerror(errno));

a) Did you mean %1%?
b) Could not what?

+                               return stream;
+                       }
+                       FILE *newin = fdopen(fd, "rb");

Should the return value of fdopen not also be checked?

Bastiaan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]