Xref: utzoo comp.unix.internals:1364 comp.unix.programmer:659 Path: utzoo!attcan!uunet!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!news.cs.indiana.edu!cs.widener.edu!netnews.upenn.edu!msuinfo!rang From: rang@cs.wisc.edu (Anton Rang) Newsgroups: comp.unix.internals,comp.unix.programmer Subject: Re: gets() during signal Message-ID: Date: 10 Dec 90 21:49:15 GMT References: <25232@adm.brl.mil> Sender: news@msuinfo.cl.msu.edu Followup-To: comp.unix.programmer Organization: UW-Madison CS department Lines: 15 In-Reply-To: stanonik@nprdc.navy.mil's message of 10 Dec 90 18:09:53 GMT In article <25232@adm.brl.mil> stanonik@nprdc.navy.mil (Ron Stanonik) writes: >I just ran into a problem while porting a program from 4.3bsd to >sunos4.1. The problem is that gets() in signal handlers seems to >reset stdio's write pointer, but not the read pointer. As far as I know, UNIX stdio packages are not re-entrant. Don't try to use any of the input routines, in particular, inside a signal handler. I'm not sure if the output routines are safe, but I wouldn't count on them--I've seen implementations of printf() which used a static buffer internally. I've moved followups to comp.unix.programmer, which is probably where this really belongs... (?) Anton +---------------------------+------------------+-------------+ | Anton Rang (grad student) | rang@cs.wisc.edu | UW--Madison | +---------------------------+------------------+-------------+