X-Git-Url: http://sigaev.ru/git/gitweb.cgi?p=remotetop.git;a=blobdiff_plain;f=rtop.c;fp=rtop.c;h=59b166411ceabbd8cdcebc5af1c8636711589c4a;hp=85a0eb330b60bedec9c011c123bc03be4598169f;hb=0440f7f90885227829b0fdfa8f52b4f843423484;hpb=72d828bf3924ad09b92e247c8806447b373c1c64 diff --git a/rtop.c b/rtop.c index 85a0eb3..59b1664 100644 --- a/rtop.c +++ b/rtop.c @@ -68,11 +68,10 @@ main( int argc, char *argv[] ) { int i; MassiveUnit *mu; - TCMsg *pmsg = (TCMsg*)malloc( TCMSGHDRSZ ); + TCMsg *pmsg; TC_Connection cs; - pmsg->type = TOPGETTYPE; - pmsg->len = TCMSGHDRSZ; + opentlog( TL_OPEN_STDERR, TL_INFO, NULL); while( (ch=getopt(argc, argv, "Dh:p:"))!=-1) { switch(ch) { @@ -97,9 +96,14 @@ main( int argc, char *argv[] ) { opentlog( TL_OPEN_STDERR, (debug) ? TL_DEBUG : TL_INFO, NULL); TC_fillConnection(&cs, host, port); + + pmsg = (TCMsg*)tmalloc( TCMSGHDRSZ ); + pmsg->type = TOPGETTYPE; + pmsg->len = TCMSGHDRSZ; cs.buf = (char*)pmsg; cs.len = pmsg->len; - if ( TC_Talk(&cs) == CS_OK ) { + + if ( TC_Talk(&cs, 0) == CS_OK ) { pmsg = (TCMsg*) cs.buf; mu = (MassiveUnit*)pmsg->data;