]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
df: avoid multibyte character corruption on macOS
authorChih-Hsuan Yen <yan12125@gmail.com>
Sat, 21 Jul 2018 20:19:23 +0000 (13:19 -0700)
committerPádraig Brady <P@draigBrady.com>
Thu, 26 Jul 2018 17:24:41 +0000 (10:24 -0700)
* src/df.c (hide_problematic_chars): Use c_iscntrl() as
passing 8 bit characters to iscntrl() is not supported on macOS.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/32236

NEWS
src/df.c

diff --git a/NEWS b/NEWS
index af1a9903defd05334f2cd1cebc0bd2d8d08b8676..aa3b4f9947f60ae9f3691530ee8ee90a41c106f7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@ GNU coreutils NEWS                                    -*- outline -*-
 
 * Noteworthy changes in release ?.? (????-??-??) [?]
 
+** Bug fixes
+
+  df no longer corrupts displayed multibyte characters on macOS.
+
 
 * Noteworthy changes in release 8.30 (2018-07-01) [stable]
 
index 11788654b9ba7a0a952fb7981919ea321f65f25f..c851fcc682134a1b7a5def9ffdaddb4c78a95143 100644 (file)
--- a/src/df.c
+++ b/src/df.c
@@ -23,6 +23,7 @@
 #include <sys/types.h>
 #include <getopt.h>
 #include <assert.h>
+#include <c-ctype.h>
 
 #include "system.h"
 #include "canonicalize.h"
@@ -281,7 +282,7 @@ hide_problematic_chars (char *cell)
   char *p = cell;
   while (*p)
     {
-      if (iscntrl (to_uchar (*p)))
+      if (c_iscntrl (to_uchar (*p)))
         *p = '?';
       p++;
     }