texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[6285] pseudotty minor fixes


From: Gavin D. Smith
Subject: [6285] pseudotty minor fixes
Date: Thu, 21 May 2015 18:53:04 +0000

Revision: 6285
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6285
Author:   gavin
Date:     2015-05-21 18:53:03 +0000 (Thu, 21 May 2015)
Log Message:
-----------
pseudotty minor fixes

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/pseudotty.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2015-05-20 22:41:07 UTC (rev 6284)
+++ trunk/ChangeLog     2015-05-21 18:53:03 UTC (rev 6285)
@@ -1,3 +1,9 @@
+2015-05-21  Gavin Smith  <address@hidden>
+
+       * info/pseudotty.c: Check return value of fclose.  Use an int to 
+       hold return value of read.  Consistent syntax for infinite 
+       loops.  (Suggestions from Karl Berry.)
+
 2015-05-20  Karl Berry  <address@hidden>
 
        * util/texi2dvi (generated_files_get): make punctuation optional

Modified: trunk/info/pseudotty.c
===================================================================
--- trunk/info/pseudotty.c      2015-05-20 22:41:07 UTC (rev 6284)
+++ trunk/info/pseudotty.c      2015-05-21 18:53:03 UTC (rev 6285)
@@ -59,13 +59,17 @@
     exit (1);
 
   error (0, 0, "%s", name);
+
   printf ("%s\n", name);
-  fclose (stdout);
+  if (fclose (stdout) != 0)
+    {
+      error (1, 0, "error closing stdout: aborting");
+    }
 
   FD_ZERO (&read_set);
 
   error (0, 0, "entering main loop");
-  for (;;)
+  while (1)
     {
       FD_SET (master, &read_set);
       FD_SET (CONTROL, &read_set);
@@ -74,9 +78,10 @@
 
       if (FD_ISSET (CONTROL, &read_set))
         {
-          char c, success;
+          char c;
+          int success;
           errno = 0;
-          do
+          while (1)
             {
               error (0, 0, "trying to read");
               success = read (CONTROL, &c, 1);
@@ -90,8 +95,7 @@
                 }
               else if (success == 0)
                 {
-                  error (0, 0, "end of file on control channel");
-                  exit (1);
+                  error (1, 0, "end of file on control channel");
                 }
               else if (success == 1)
                 {
@@ -99,7 +103,6 @@
                   break;
                 }
             }
-          while (1);
 
           /* Feed any read bytes to the program being controlled. */
           write (master, &c, 1);
@@ -107,7 +110,8 @@
 
       if (FD_ISSET (master, &read_set))
         {
-          int c, success;
+          char c;
+          int success;
           errno = 0;
           do
             {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]