]> diplodocus.org Git - nmh/blobdiff - test/runpty.c
lock_file.c: close(2) file descriptor on failure, avoiding leak.
[nmh] / test / runpty.c
index 2645d6792f30c31cc00dd65e8a323f40faf73f5f..1585df94b832404036f27946887ba26d0edf5a7f 100644 (file)
@@ -24,7 +24,7 @@ int
 main(int argc, char *argv[])
 {
     int master_in, master_out, slave, cc, status;
-    time_t starttime;
+    time_t starttime, now;
     const char *slavename;
     pid_t child;
     unsigned char readbuf[1024];
@@ -169,8 +169,10 @@ main(int argc, char *argv[])
            }
        }
 
-       if (time(NULL) >= starttime + COMMAND_TIMEOUT) {
-           fprintf(stderr, "Command execution timed out\n");
+        now = time(NULL);
+       if (now >= starttime + COMMAND_TIMEOUT) {
+           fprintf(stderr, "Command execution timed out: %ld to %ld: %d\n",
+                starttime, now, cc);
            break;
        }
     }