ia64/xen-unstable

changeset 4066:94b7d61e3dfe

bitkeeper revision 1.1159.258.35 (42305966D0gCjlR6KGQJ4LZR2FIX3g)

Fix to xfrd stream handling which was messing up save/restore/migrate on some systems.
Signed-off-by: ian@xensource.com
author iap10@freefall.cl.cam.ac.uk
date Thu Mar 10 14:27:50 2005 +0000 (2005-03-10)
parents 7a898f4725b2
children 2451944220aa
files tools/libxutil/file_stream.c tools/xfrd/xfrd.c
line diff
     1.1 --- a/tools/libxutil/file_stream.c	Wed Mar 09 02:02:39 2005 +0000
     1.2 +++ b/tools/libxutil/file_stream.c	Thu Mar 10 14:27:50 2005 +0000
     1.3 @@ -69,18 +69,28 @@ IOStream *iostdout = &_iostdout;
     1.4  /** IOStream for stderr. */
     1.5  IOStream *iostderr = &_iostderr;
     1.6  
     1.7 -/** Get the underlying FILE*.
     1.8 - * 
     1.9 +/* Get the underlying FILE*.
    1.10 + *
    1.11   * @param s file stream
    1.12   * @return the stream s wraps
    1.13   */
    1.14  static inline FILE *get_file(IOStream *s){
    1.15 -    switch((long)s->data){
    1.16 -    case 1: s->data = stdin; break;
    1.17 -    case 2: s->data = stdout; break;
    1.18 -    case 3: s->data = stderr; break;
    1.19 -    }
    1.20 -    return (FILE*)s->data;
    1.21 +     FILE *data = NULL;
    1.22 +     switch((long)s->data){
    1.23 +     case 1:
    1.24 +         data = stdin;
    1.25 +         break;
    1.26 +     case 2:
    1.27 +         data = stdout;
    1.28 +         break;
    1.29 +     case 3:
    1.30 +         data = stderr;
    1.31 +         break;
    1.32 +     default:
    1.33 +         data = (FILE*)s->data;
    1.34 +         break;
    1.35 +     }
    1.36 +     return data;
    1.37  }
    1.38  
    1.39  /** Control buffering on the underlying stream, like setvbuf().
     2.1 --- a/tools/xfrd/xfrd.c	Wed Mar 09 02:02:39 2005 +0000
     2.2 +++ b/tools/xfrd/xfrd.c	Thu Mar 10 14:27:50 2005 +0000
     2.3 @@ -1007,6 +1007,8 @@ int xfrd_accept(Args *args, int sock){
     2.4      }
     2.5      iprintf("> Accepted connection from %s:%d on %d\n",
     2.6              inet_ntoa(peer_in.sin_addr), htons(peer_in.sin_port), sock);
     2.7 +    fflush(stdout);
     2.8 +    fflush(stderr);
     2.9      pid = fork();
    2.10      if(pid > 0){
    2.11          // Parent, fork succeeded.