From c3a7c7a4e107daff5ba3663a34ec2efb836e8c0b Mon Sep 17 00:00:00 2001 From: River Tarnell Date: Thu, 7 Jul 2005 02:29:55 +0000 Subject: [PATCH] error handling is your friend --- install-utils.inc | 4 +++- maintenance/mcc.php | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/install-utils.inc b/install-utils.inc index 913dae531e..2846fcad12 100644 --- a/install-utils.inc +++ b/install-utils.inc @@ -62,7 +62,9 @@ function readconsole( $prompt = '' ) { } else { print $prompt; $fp = fopen( 'php://stdin', 'r' ); - $resp = trim( fgets( $fp, 1024 ) ); + $st = fgets($fp, 1024); + if ($st === false) return false; + $resp = trim( $st ) ); fclose( $fp ); return $resp; } diff --git a/maintenance/mcc.php b/maintenance/mcc.php index b7697c730b..73b03a1398 100755 --- a/maintenance/mcc.php +++ b/maintenance/mcc.php @@ -19,6 +19,7 @@ do { $bad = false; $quit = false; $line = readconsole( "> " ); + if ($line === false) exit; $args = explode( " ", $line ); $command = array_shift( $args ); switch ( $command ) { -- 2.20.1