$NetBSD$

--- libfsimage/fat/fsys_fat.c.orig	2008-01-31 10:06:54.000000000 +0000
+++ libfsimage/fat/fsys_fat.c	2008-03-01 11:52:29.000000000 +0000
@@ -301,7 +301,7 @@ fat_dir (fsi_file_t *ffi, char *dirname)
   /* if we have a real file (and we're not just printing possibilities),
      then this is where we want to exit */
   
-  if (!*dirname || isspace (*dirname))
+  if (!*dirname || isspace ((uint8_t)*dirname))
     {
       if (attrib & FAT_ATTRIB_DIR)
 	{
@@ -325,7 +325,7 @@ fat_dir (fsi_file_t *ffi, char *dirname)
   /* Directories don't have a file size */
   filemax = INT_MAX;
   
-  for (rest = dirname; (ch = *rest) && !isspace (ch) && ch != '/'; rest++);
+  for (rest = dirname; (ch = *rest) && !isspace ((uint8_t)ch) && ch != '/'; rest++);
   
   *rest = 0;
   
@@ -426,12 +426,12 @@ fat_dir (fsi_file_t *ffi, char *dirname)
       {
 	int i, j, c;
 	
-	for (i = 0; i < 8 && (c = filename[i] = tolower (dir_buf[i]))
+	for (i = 0; i < 8 && (c = filename[i] = tolower ((uint8_t)dir_buf[i]))
 	       && !isspace (c); i++);
 	
 	filename[i++] = '.';
 	
-	for (j = 0; j < 3 && (c = filename[i + j] = tolower (dir_buf[8 + j]))
+	for (j = 0; j < 3 && (c = filename[i + j] = tolower ((uint8_t)dir_buf[8 + j]))
 	       && !isspace (c); j++);
 	
 	if (j == 0)
