On OS/2 kLIBC, fdopen() creates a stream in a mode of a file
descriptor. So specify "t" to open a stream in text mode explicitly
on OS/2.

* modules/gnu.c (esyscmd): fdopen() in text mode on OS/2.
---
 modules/gnu.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/modules/gnu.c b/modules/gnu.c
index 874502e..7abd2cf 100644
--- a/modules/gnu.c
+++ b/modules/gnu.c
@@ -684,7 +684,12 @@ M4BUILTIN_HANDLER (esyscmd)
           m4_set_sysval (127);
           return;
         }
-      pin = fdopen (fd, "r");
+#if OS2
+# define MODE_TEXT "t"
+#else
+# define MODE_TEXT ""
+#endif
+      pin = fdopen (fd, "r" MODE_TEXT);
       if (!pin)
         {
           m4_error (context, 0, errno, me, _("cannot run command %s"),
-- 
1.8.5.2


_______________________________________________
M4-patches mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/m4-patches

Reply via email to