|
Message-ID: <20211025144431.00718c87@tpx.quinq.eu.org> Date: Mon, 25 Oct 2021 14:44:31 +0200 From: Quentin Rameau <quinq@...th.space> To: musl@...ts.openwall.com Subject: Re: request: please detect reads from stdin with unflushed writes to stdout > Hello, Hi Lorenzo, > there are a few programs around that do something like > printf("question: "); > fgets(ans, sizeof ans, stdin); > > without fflushing stdout and get away with it because it happens to work > under glibc. > (fyi the ones I stumbled onto are mkfs.xfs and, vipw/vigr from util-linux, > then the developer noticed the same with chfn/chsh) > > Ideally that would be taken care of by either some compiler warning (but > not even clang's -Weverything catches that) or by some static analysis > tool, but I couldn't find any. > > ... with do_something() being either flushing stdout or printing some kind > of warning to stderr (isatty?) or to syslog. > Any suggestion, corrections etc are obviously very welcome. Suggestion: fix those broken programs! If one wants to make sure what you print is flushed at a certain point, ones have to flush the stream.
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.