(write_charmaps): Don't get stuck in a loop if the file ends in a long
authordrepper <drepper>
Wed, 21 May 1997 00:55:20 +0000 (00:55 +0000)
committerdrepper <drepper>
Wed, 21 May 1997 00:55:20 +0000 (00:55 +0000)
line without newline.

locale/programs/locale.c

index 28ad944..52ae56a 100644 (file)
@@ -504,9 +504,9 @@ write_charmaps (void)
                    if (fscanf (fp, " <code_set_name> %as", &name) == 1)
                      break;
 
-                   do
-                     fgets (junk, sizeof junk, fp);
-                   while (strchr (junk, '\n') == NULL);
+                   while (fgets (junk, sizeof junk, fp) != NULL
+                          && strchr (junk, '\n') == NULL)
+                     continue;
                  }
 
                fclose (fp);