Terminate if the tty is gone
authorJoey Schulze <joey@infodrom.org>
Thu, 22 Nov 2007 21:01:16 +0000 (21:01 +0000)
committerJoey Schulze <joey@infodrom.org>
Thu, 22 Nov 2007 21:01:16 +0000 (21:01 +0000)
newmail.c

index 6c9023b..e96bd16 100644 (file)
--- a/newmail.c
+++ b/newmail.c
@@ -90,6 +90,10 @@ int main(int argc, char *argv[])
 
     /* wait for the next incarnation */
     sleep (opt_interval);
+
+    /* Terminate if we lost out tty */
+    if (!isatty(1))
+      return 1;
   }
 
   /* Not reached */