Xref: utzoo comp.lang.c:38928 comp.unix.sysv386:7651 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!tellab5!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.lang.c,comp.unix.sysv386 Subject: Re: How to execute 'sz' and 'rc' ? Message-ID: <1991May01.054356.10098@chinet.chi.il.us> Date: 1 May 91 05:43:56 GMT References: <1991Apr29.221812.5038@nicedel.north.de> Organization: Chinet - Chicago Public Access UNIX Lines: 21 In article <1991Apr29.221812.5038@nicedel.north.de> nyse@nicedel.north.de (Hermann Behrens) writes: > if((pid = fork()) == 0) { > close(fp); > close(0); > open("/dev/ttyF00", O_RDONLY | O_NDELAY); > close(1); > open("/dev/ttyF00", O_WRONLY | O_NDELAY); >/* I think, that the bug is in the redirecting of stdin and stdout, >but where is the bug?? */ > execl("/bin/sh", "sh", "-c", "sz a_file",NULL); On the machines I use, leaving O_NDELAY set will cause very strange things to happen when you try to write to a device and reads will complete when no data is present. I'd suggest leaving out the O_NDELAY on the open if you have reason to expect that carrier is already up (but you might want to set an alarm to bail you out just in case). Or, use fcntl() to turn it off after the open before you let another program try to access the line. Les Mikesell les@chinet.chi.il.us