bug-patch
[Top][All Lists]
Advanced

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

[bug-patch] [PATCH] avoid a used-uninitialized error


From: Jim Meyering
Subject: [bug-patch] [PATCH] avoid a used-uninitialized error
Date: Tue, 24 May 2011 13:15:37 +0200

I did not try to see if fixing this bug changes how patch works.


>From f263642b2bfb76efca6d7df1d35f54bd10d81b2b Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 24 May 2011 12:11:32 +0200
Subject: [PATCH] avoid a used-uninitialized error

* src/util.c (fetchname): Avoid a used-uninitialized error.
Before, when "*t == '\n'", stamp.tv_nsec would have been
used undefined.  The fix is to set that member rather than
stamp.tv_sec, which is already set to the desired value.
This was reported by coverity.
---
 src/util.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/util.c b/src/util.c
index 6950842..1016a8c 100644
--- a/src/util.c
+++ b/src/util.c
@@ -1498,7 +1498,7 @@ fetchname (char const *at, int strip_leading, bool 
maybe_quoted, char **pname,
       }

       if (*t == '\n')
-       stamp.tv_sec = -1;
+       stamp.tv_nsec = -1;
       else
        {
          if (! pstamp)
--
1.7.5.2.585.gfbd48



reply via email to

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