[rrd-developers] Re: BUG: attempt to put segment in horiz list twice ??
    Ruud H.G. van Tol 
    rvtol at isolution.nl
       
    Wed Jul 27 18:32:08 MEST 2005
    
    
  
Per Jessen:
> [system()]
> when I use "rrdtool graph -"
I read news://news.gmane.org/gmane.comp.db.rrdtol.user later
and saw how you use rrdtool.
> The code that produces good PNGs but make the browser hang:
>
>         oldstdout=dup(1);       // take a copy of stdout
>         oldstderr=dup(2);
>         dup2(s,1);              // make stdout = s
>         close(2);               // close stderr
>
>         system(buffer);         // call rrdtool to do the biz.
>
>         dup2(oldstdout,1);      // restore stdout.
>         dup2(oldstderr,2);
You shouldn't close stderr, but redirect it somewhere, like to a file or
to /dev/null.
Is the command-string in 'buffer' properly terminated with a 0-byte?
Or *maybe*, as an alternative way to restore stderr, leave all that code
as is, but replace the line with "dup2(oldstderr,2);" by:
  close(2);
  dup(oldstderr);
  close(oldsterr);
which I copied from:
http://cvs.opensolaris.org/source/xref/usr/src/cmd/lp/filter/postscript/postio/ifdef.c
>> In a system() call, you can append " 2>$tmpfile" to the commandline.
>
> Yeah, I did think of that too - I'll have to try it again, but I
> think it produced the same result (browser hangs).
Do a test with "rrdtool graph - 2>/dev/null"
and also test "2>/dev/null rrdtool graph -"
Which shell do you use?
-- 
Grtz, Ruud
--
Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive     http://lists.ee.ethz.ch/rrd-developers
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi
    
    
More information about the rrd-developers
mailing list