1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
Description: fix -i (background) option to not require a tty
Author: Jeff King <peff-debbug@peff.net>
Reviewed-by: Junichi Uekawa <dancer@debian.org>
Bug-Debian: https://bugs.debian.org/206319
Last-Update: 2024-12-24
Forwarded: not-needed
--- a/xphoon.c
+++ b/xphoon.c
@@ -25,6 +25,7 @@
#include <math.h>
#include <limits.h> /* added by Lalo Martins */
#include <sys/ioctl.h>
+#include <errno.h> /* added by Jeff King */
#include "tws.h"
@@ -202,9 +203,14 @@
tty = open( "/dev/tty", 0 );
if ( tty < 0 )
{
- (void) fprintf( stderr, "%s: ", argv0 );
- perror( "/dev/tty open" );
- exit( 1 );
+ /* if we don't have a tty, don't flag an error
+ * Jeff King, Aug 20 2003 */
+ if ( errno != ENXIO )
+ {
+ (void) fprintf( stderr, "%s: ", argv0 );
+ perror( "/dev/tty open" );
+ exit( 1 );
+ }
}
else
{
|