coreutils
[Top][All Lists]
Advanced

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

[PATCH] maint: avoid a static analysis warning in expand-common


From: Pádraig Brady
Subject: [PATCH] maint: avoid a static analysis warning in expand-common
Date: Sun, 19 Mar 2017 23:03:18 -0700

* src/expand-common.c (next_file): We're dependent on calling
this function with NULL to initialize things appropriately.
So enforce this with assert(), which avoids a warning from
clang-anaylzer.
---
 src/expand-common.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/expand-common.c b/src/expand-common.c
index 0728e70..e1b549f 100644
--- a/src/expand-common.c
+++ b/src/expand-common.c
@@ -16,6 +16,7 @@
 
 #include <config.h>
 
+#include <assert.h>
 #include <stdio.h>
 #include <sys/types.h>
 #include "system.h"
@@ -282,6 +283,7 @@ next_file (FILE *fp)
 
   if (fp)
     {
+      assert (prev_file);
       if (ferror (fp))
         {
           error (0, errno, "%s", quotef (prev_file));
-- 
2.9.3




reply via email to

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