bug-findutils
[Top][All Lists]
Advanced

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

[PATCH] Fix Savannah bug #30180, wrong error message for -size b300


From: James Youngman
Subject: [PATCH] Fix Savannah bug #30180, wrong error message for -size b300
Date: Sun, 15 Aug 2010 16:48:15 +0100

* find/parser.c (parse_size): Don't print a suffix in the error
message if no suffix was specified.
* NEWS: Mention this change.
---
 ChangeLog     |    5 +++++
 NEWS          |    2 ++
 find/parser.c |   11 ++++++++---
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b88b504..5395d22 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-08-15  James Youngman  <address@hidden>
 
+       Fix Savannah bug #30180, wrong error message for -size b300
+       * find/parser.c (parse_size): Don't print a suffix in the error
+       message if no suffix was specified.
+       * NEWS: Mention this change.
+
        * po/da.po: Update Danish translation.
 
 2010-05-11  John Gilmore  <address@hidden>
diff --git a/NEWS b/NEWS
index ee79872..a9885a2 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,8 @@ GNU findutils NEWS - User visible changes.      -*- outline -*- 
(allout)
 
 ** Bug Fixes
 
+#30180: error message from incorrect -size option is off
+
 #29828: test suite deadlock on FreeBSD.
 
 ** Translations
diff --git a/find/parser.c b/find/parser.c
index 20d9533..e99b13e 100644
--- a/find/parser.c
+++ b/find/parser.c
@@ -2316,6 +2316,7 @@ parse_size (const struct parser_table* entry, char 
**argv, int *arg_ptr)
     case '7':
     case '8':
     case '9':
+      suffix = 0;
       break;
 
     default:
@@ -2325,12 +2326,16 @@ parse_size (const struct parser_table* entry, char 
**argv, int *arg_ptr)
   /* TODO: accept fractional megabytes etc. ? */
   if (!get_num (arg, &num, &c_type))
     {
+      char tail[2];
+      tail[0] = suffix;
+      tail[1] = 0;
+
       error (EXIT_FAILURE, 0,
-            _("Invalid argument `%s%c' to -size"),
-            arg, (int)suffix);
+            _("Invalid argument `%s%s' to -size"),
+            arg, tail);
       return false;
     }
-our_pred = insert_primary (entry, arg);
+  our_pred = insert_primary (entry, arg);
   our_pred->args.size.kind = c_type;
   our_pred->args.size.blocksize = blksize;
   our_pred->args.size.size = num;
-- 
1.7.1




reply via email to

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