Thread: un-terminated stream

  1. #1
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    Posts
    271

    un-terminated stream

    Please I need some help with this badly.
    Code:
    if (fork() == 0)
    {
            if ((fd = open(fdump, O_CREAT | O_WRONLY | O_APPEND, 0660)) < 0)
            fprintf (stderr,"ERROR(opening file): %s.\n", strerror(errno));
    
                    dup2(fd, STDOUT);
    
            if ((execl("/usr/bin/top","-b", "-n", "1",  NULL)) < 0) <----- this is my problem line here.
            fprintf (stderr,"ERROR(execl): %s.\n", strerror(errno));  
    
    
            /*close(pd[READ]);              //close read end of the pipe
            write(pd[WRITE], pmsgBUF, strlen(pmsgBUF)+1);
            printf("Sent to Parent: %s.\n", pmsgBUF);
            close(pd[WRITE]);*/                     //close write end
            close(fd);
            exit(0);
    top seems to keep something open (mayhaps the stream) which hangs the server. The client gets a [red]"connection refused[/red] error which is due to the server's tty (terminal) being suspended.
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

  2. #2
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    Posts
    271

    Angry attached files for my post

    Oh here are the attached files.
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. New stream flushing FAQ candidate?
    By Sebastiani in forum C Programming
    Replies: 9
    Last Post: 07-01-2009, 05:57 PM
  2. Discard wrong data from stream
    By mesmer in forum C Programming
    Replies: 7
    Last Post: 11-16-2008, 02:30 AM
  3. Closing a stream
    By cunnus88 in forum C++ Programming
    Replies: 8
    Last Post: 02-21-2008, 05:15 PM
  4. Help! About text stream and binary stream
    By Antigloss in forum C Programming
    Replies: 1
    Last Post: 09-01-2005, 08:40 AM
  5. Buffering??
    By Brain Cell in forum C Programming
    Replies: 15
    Last Post: 09-21-2004, 06:57 AM