[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 20050926:LDM: feedme bug?



David,

Sorry about that.  The use of "datap" is a relic from the downstream LDM
code, from which I copied it.

Remove the declaration

    static char* datap;

and replace

    if( write(STDOUT_FILENO, datap, dpkp->data.dbuf_len) !=

with

    if( write(STDOUT_FILENO, dpkp->data.dbuf_val, dpkp->data.dbuf_len) !=

Regards,
Steve Emmerson

------- Original Message

Date:    Mon, 03 Oct 2005 10:25:21 -0500
From:    David Wojtowicz <address@hidden>To:      Steve Emmerson <steve@unidat
          a.ucar.edu>
Subject: Re: 20050926:LDM: feedme bug? 

  Actually....

I was mistaken.... I was too hasty in saying that it worked. I hadn't  
yet tested the actual output... just the log messages and hadn't let  
it run very long.

There is a new problem.

Below is the diff between the previous version and the new one of  
feedme.c.      In addition to the XDR related changes, I see the  
addition of "static char *datap;"  and the switch from "dpkp- 
 >data.dbuf_val"  to "datap"  in the write() call in the example  
output section.  However, I don't see where datap is being set  
anyplace.    Because it is uninitialized, you either get garbage for  
output, a write failure or a seg fault.




diff -c ldm-6.4.1/src/feedme/feedme.c ldm-6.4.2.4/src/feedme/feedme.c
*** ldm-6.4.1/src/feedme/feedme.c       Wed Jan 26 21:34:11 2005
--- ldm-6.4.2.4/src/feedme/feedme.c     Tue Sep 27 16:40:59 2005
***************
*** 2,8 ****
    *   Copyright 1993, University Corporation for Atmospheric Research
    *   See ../COPYRIGHT file for copying and redistribution conditions.
    */
! /* $Id: feedme.c,v 1.61.12.3 2005/01/26 21:34:11 steve Exp $ */

   /*
    * listens for data
--- 2,8 ----
    *   Copyright 1993, University Corporation for Atmospheric Research
    *   See ../COPYRIGHT file for copying and redistribution conditions.
    */
! /* $Id: feedme.c,v 1.61.12.5 2005/09/27 16:40:59 steve Exp $ */

   /*
    * listens for data
***************
*** 25,30 ****
--- 25,31 ----
   #include "inetutil.h"
   #include "ldm5_clnt.h"
   #include "RegularExpressions.h"
+ #include "xdr_data.h"

   #ifdef NO_ATEXIT
   #include "atexit.h"
***************
*** 203,208 ****
--- 204,210 ----
   static unsigned remaining;
   static timestampt arrival;
   static char infostr[50 + KEYSIZE]; /* only used for log messages */
+ static char* datap;

   /*ARGSUSED*/
   ldm_replyt *
***************
*** 269,284 ****
           /*
            * your code here, example writes to stdout
            */
!         if( write(STDOUT_FILENO, dpkp->data.dbuf_val, dpkp- 
 >data.dbuf_len) !=
                           dpkp->data.dbuf_len)
           {
                   serror( "data write failed") ;
                   exit(1) ;
           }

           return(&reply);
   err:
           svcerr_systemerr(rqstp->rq_xprt);
           return NULL;
   }

--- 271,289 ----
           /*
            * your code here, example writes to stdout
            */
!         if( write(STDOUT_FILENO, datap, dpkp->data.dbuf_len) !=
                           dpkp->data.dbuf_len)
           {
                   serror( "data write failed") ;
                   exit(1) ;
           }

+         xd_reset();                     /* reset XDR data-buffer */
+
           return(&reply);
   err:
           svcerr_systemerr(rqstp->rq_xprt);
+         xd_reset();
           return NULL;
   }




On Oct 3, 2005, at 9:26 AM, Steve Emmerson wrote:

> David,
>
>
>> Date: Mon, 3 Oct 2005 09:17:02 -0500
>> From: David Wojtowicz <address@hidden>
>> Organization: University of Illinois at Urbana-Champaign
>> To: Steve Emmerson <address@hidden>
>> Subject: Re: 20050926:LDM: feedme bug?
>>
>
> The above message contained the following:
>
>
>> Yes, the stock feedme works now it seems.   I'll have to patch in my
>> code into the "Your code here" part to know for sure, but I hope to
>> get to that shortly.
>>
>
> Glad to hear it.
>
> Regards,
> Steve Emmerson
>

------- End of Original Message