[lttng-dev] [LTTV PATCH 1/2] Fix format string warnings

Alexandre Montplaisir alexandre.montplaisir at gmail.com
Wed Dec 7 10:10:27 EST 2011


Or `make check' fails when building with -Werror=format-security
(which is what Launchpad uses).

Signed-off-by: Alexandre Montplaisir <alexandre.montplaisir at gmail.com>
---
 lttv/lttv/sync/event_processing_text.c |   10 +++++-----
 lttv/lttv/sync/sync_chain_unittest.c   |    2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lttv/lttv/sync/event_processing_text.c b/lttv/lttv/sync/event_processing_text.c
index bcbea9b..a99d0e3 100644
--- a/lttv/lttv/sync/event_processing_text.c
+++ b/lttv/lttv/sync/event_processing_text.c
@@ -95,7 +95,7 @@ static void initProcessingText(SyncState* const syncState, ...)
 	processingData->testCase= fopen(testCaseName, "r");
 	if (processingData->testCase == NULL)
 	{
-		g_error(strerror(errno));
+		g_error("%s", strerror(errno));
 	}
 	syncState->traceNb= readTraceNb(processingData->testCase);
 
@@ -162,7 +162,7 @@ static AllFactors* finalizeProcessingText(SyncState* const syncState)
 
 		if (retval == -1 && !feof(testCase))
 		{
-			g_error(strerror(errno));
+			g_error("%s", strerror(errno));
 		}
 
 		if (line[retval - 1] == '\n')
@@ -174,7 +174,7 @@ static AllFactors* finalizeProcessingText(SyncState* const syncState)
 			&sendTime, &recvTime, &tmp);
 		if (retval == EOF)
 		{
-			g_error(strerror(errno));
+			g_error("%s", strerror(errno));
 		}
 		else if (retval != 4)
 		{
@@ -311,7 +311,7 @@ static unsigned int readTraceNb(FILE* testCase)
 		}
 		else
 		{
-			g_error(strerror(errno));
+			g_error("%s", strerror(errno));
 		}
 	}
 	if (line[retval - 1] == '\n')
@@ -365,7 +365,7 @@ static void skipCommentLines(FILE* testCase)
 				}
 				else
 				{
-					g_error(strerror(errno));
+					g_error("%s", strerror(errno));
 				}
 			}
 		}
diff --git a/lttv/lttv/sync/sync_chain_unittest.c b/lttv/lttv/sync/sync_chain_unittest.c
index 40302a0..276c71c 100644
--- a/lttv/lttv/sync/sync_chain_unittest.c
+++ b/lttv/lttv/sync/sync_chain_unittest.c
@@ -256,7 +256,7 @@ int main(const int argc, char* const argv[])
 
 		if (fclose(syncState->graphsStream) != 0)
 		{
-			g_error(strerror(errno));
+			g_error("%s", strerror(errno));
 		}
 	}
 
-- 
1.7.7.3




More information about the lttng-dev mailing list