From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <7c5cebdf3737a09809929e7aa9a0e03e@coraid.com> From: erik quanstrom Date: Tue, 7 Nov 2006 19:16:14 -0500 To: 9fans@cse.psu.edu Subject: Re: [9fans] Here is a silly question.. In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: dca2536c-ead1-11e9-9d60-3106f5b1d025 you need to increment try each time through the loop. this works for me: #include #include void fu(void) { int rd, try; char buf[1024]; for(try=0; try < 2; try++){ alarm(2 * 1000); rd = read(0, buf, 1024); alarm(0); if(rd > 0) { write(1, buf, rd); break; } } } void main(void) { fu(); exits(""); }