From 0b2c65561b08204bc3fa30e8f79ccecccd2fd038 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Sun, 25 Nov 2018 17:52:22 -0800 Subject: [PATCH] Use proper function to read a line of input --- miniserv.pl | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/miniserv.pl b/miniserv.pl index 25fe55aa1..2aebd593b 100755 --- a/miniserv.pl +++ b/miniserv.pl @@ -988,8 +988,7 @@ while(1) { # this sub-process is asking about a password local $infd = $passin[$i]; local $outfd = $passout[$i]; - #local $inline = <$infd>; - local $inline = &sysread_line($infd); + local $inline = <$infd>; if ($inline) { print DEBUG "main: inline $inline"; } @@ -3086,22 +3085,6 @@ else { } } -# sysread_line(fh) -# Read a line from a file handle, using sysread to get a byte at a time -sub sysread_line -{ -local ($fh) = @_; -local $line; -while(1) { - local ($buf, $got); - $got = sysread($fh, $buf, 1); - last if ($got <= 0); - $line .= $buf; - last if ($buf eq "\n"); - } -return $line; -} - # wait_for_data(secs) # Waits at most the given amount of time for some data on SOCK, returning # 0 if not found, 1 if some arrived.