bug-cpio
[Top][All Lists]
Advanced

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

[Bug-cpio] [PATCH] Fix a truncation check when assigning long to int


From: Vitezslav Cizek
Subject: [Bug-cpio] [PATCH] Fix a truncation check when assigning long to int
Date: Tue, 29 Jul 2014 13:27:42 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Hi,
There's a weird piece of code in mt.c.
I guess it's supposed to be a check for truncation when assigning a
long variable to an int, which includes a typo.
The (count = val) != count) condition is evaluated to FALSE by gcc.

Signed-off-by: Vitezslav Cizek <address@hidden>
---
 src/mt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mt.c b/src/mt.c
index cc5cbb9..15c3d77 100644
--- a/src/mt.c
+++ b/src/mt.c
@@ -208,7 +208,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
          {
            char *p;
            long val = strtol (arg, &p, 0);
-           if (*p || (count = val) != count)
+           if (*p || (count = val) != val)
              error (MT_EXIT_INVOP, 0, _("invalid count value"));
          }
          break;
-- 
1.8.4.5


-- 
Vita Cizek

Attachment: signature.asc
Description: Digital signature


reply via email to

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