diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-07-23 17:13:49 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-07-23 17:13:49 +0200 |
commit | 248315ada26ff8e308bb99d5e46f25534e148620 (patch) | |
tree | 37841de13bcf600337c0da810096950876a09729 | |
parent | bfd961a8e355c92b1ff1121b411c2303028b82d0 (diff) | |
download | abrt-248315ada26ff8e308bb99d5e46f25534e148620.tar.gz abrt-248315ada26ff8e308bb99d5e46f25534e148620.tar.xz abrt-248315ada26ff8e308bb99d5e46f25534e148620.zip |
style fix by popular (Zdenek's) demand
Zdenek said:
Ahother thing: commit "CCpp.cpp: fix handling of pipes when we fork children".
You added piece code with while(1) and then there is a break inside the loop.
Personally, I don't like infinite loops :-). There can be something like:
...
int r;
while ((r = read(pipeout[0], buff, sizeof(buff) - 1) > 0)
{
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | lib/Plugins/CCpp.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp index b96540a4..176a77a4 100644 --- a/lib/Plugins/CCpp.cpp +++ b/lib/Plugins/CCpp.cpp @@ -132,9 +132,10 @@ void CAnalyzerCCpp::InstallDebugInfos(const std::string& pPackage) bool already_installed = false; - while (1) + int r; + while (r = read(pipeout[0], buff, sizeof(buff) - 1) > 0) { -/* Does not seem to be needed +/* Was before read, does not seem to be needed fd_set rsfd; FD_ZERO(&rsfd); @@ -148,10 +149,6 @@ void CAnalyzerCCpp::InstallDebugInfos(const std::string& pPackage) if (!FD_ISSET(pipeout[0], &rsfd)) continue; */ - int r = read(pipeout[0], buff, sizeof(buff) - 1); - if (r <= 0) - break; - buff[r] = '\0'; comm_layer_inner_debug(buff); if (strstr(buff, packageName.c_str()) != NULL && |