aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiel van Schijndel <me@mortis.eu>2011-06-24 20:03:16 +0200
committerGiel van Schijndel <me@mortis.eu>2011-07-13 05:07:44 +0200
commitf85c0974492d9c779d45112fc943f0dbe0b95cda (patch)
tree1644cfbf0714d3afa1f9822aadc6b92fd097b8a4
parentecf1c79aada222ccbf93b0f15d98339431d1a881 (diff)
fix warnings: using the result of an assignment as a condition without parentheses [-Wparentheses]
Don't unnecessarily assign to variables within the *boolean* expression of a conditional. Signed-off-by: Giel van Schijndel <me@mortis.eu>
-rw-r--r--src/util.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 479c601ee5..7693aaa52a 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -760,8 +760,8 @@ string GetPidFile()
void CreatePidFile(string pidFile, pid_t pid)
{
- FILE* file;
- if (file = fopen(pidFile.c_str(), "w"))
+ FILE* file = fopen(pidFile.c_str(), "w");
+ if (file)
{
fprintf(file, "%d\n", pid);
fclose(file);
@@ -790,7 +790,9 @@ void ShrinkDebugFile()
fseek(file, -sizeof(pch), SEEK_END);
int nBytes = fread(pch, 1, sizeof(pch), file);
fclose(file);
- if (file = fopen(strFile.c_str(), "w"))
+
+ file = fopen(strFile.c_str(), "w");
+ if (file)
{
fwrite(pch, 1, nBytes, file);
fclose(file);