truncate: fix bug in use of isspace
authorEric Blake <ebb9@byu.net>
Thu, 7 May 2009 20:27:37 +0000 (14:27 -0600)
committerEric Blake <ebb9@byu.net>
Mon, 11 May 2009 11:52:50 +0000 (05:52 -0600)
* src/truncate.c (main): Pass unsigned characters to isspace.
* NEWS: Mention this.

NEWS
src/truncate.c

diff --git a/NEWS b/NEWS
index 6f2a401..31f1b1a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@ GNU coreutils NEWS                                    -*- outline -*-
 
 * Noteworthy changes in release ?.? (????-??-??) [?]
 
+** Bug fixes
+
+  truncate -s failed to skip all whitespace in the option argument in
+  some locales.
 
 * Noteworthy changes in release 7.4 (2009-05-07) [stable]
 
index 06fa03a..31b3aa6 100644 (file)
@@ -1,5 +1,5 @@
 /* truncate -- truncate or extend the length of files.
-   Copyright (C) 2008 Free Software Foundation, Inc.
+   Copyright (C) 2008-2009 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -287,7 +287,7 @@ main (int argc, char **argv)
 
         case 's':
           /* skip any whitespace */
-          while (isspace (*optarg))
+          while (isspace (to_uchar (*optarg)))
             optarg++;
           switch (*optarg)
             {
@@ -309,7 +309,7 @@ main (int argc, char **argv)
               break;
             }
           /* skip any whitespace */
-          while (isspace (*optarg))
+          while (isspace (to_uchar (*optarg)))
             optarg++;
           if (*optarg == '+' || *optarg == '-')
             {