[Date Prev][Date Next] [Chronological] [Thread] [Top]

unbuffered output

Not sure which list this fits best, but...

The default behaviour for Unix programs is to use buffered output for
STDOUT, and unbuffered output for STDERR.  When a program like ldapmodify
is crunching away, it will print "modifying dn...." messages on STDOUT,
and if errors crop up, it will print something like, "no such object" on
  The problem I see is that the "modifying dn" messages come out in
buffered bursts, while the error messages come out immediately. This means
the error messages don't necessarily line up sequentially with the
"modifying" message that caused them. The error message itself doesn't
mention the DN that it was working with, so all you get is an unmatchable
set of "modifying" and "error" messages.
  I'd like to be able to run these programs in -c continuous mode to get
all the right stuff done, then go back and fix the error cases after. But
with the buffering situation, I can't tell what actions caused the error

Does anyone see a problem with switching programs like ldapadd and
ldapmodify to unbuffered STDIO ? Just add a line to the start of main()

    setbuf(stdout, NULL);

I've got it running on my local copy, and it's a real sanity saver.

  -Mark Adamson
   Carnegie Mellon