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

Re: [leafnode-list] Still fighting with delaybody mode



Matthias Andree wrote:
> Juergen Salk <juergen.salk@xxxxxx> writes:
> > --- fetchnews.c.orig    Tue Jan 23 23:49:28 2001
> > +++ fetchnews.c Sun Jan 28 20:16:29 2001
> ..
> > @@ -323,13 +324,16 @@
> >      }
> >  
> >      while ( ( l = getaline( f ) ) != NULL ) {
> > +        mid = strdup( l );              /* Save msgid */
> >         putaline( "ARTICLE %s", l );
> >         if ( !getarticle( NULL ) )
> > -           appendtolist( &failed, &ptr, l );
> > +           appendtolist( &failed, &ptr, mid );
> > +        free( mid );
> 
> What's the point of this? Putaline has no access to the static buffer
> inside getaline, and appendtolist does not call getaline;

But getarticle() does. Since getaline() does not automatically
allocate new buffer, l will be overwritten which is bad if
getarticle() fails (because in that case the error message is
appended to "failed" instead of the message id). Therefore the
message id has to be stored somewhere.

I agree that error checking is desirable; but what should one do if
strdup() returns NULL - probably skip the attempt of retrieving the
article altogether?

--Cornelius.

-- 
/* Cornelius Krasel, U Wuerzburg, Dept. of Pharmacology, Versbacher Str. 9 */
/* D-97078 Wuerzburg, Germany   email: krasel@xxxxxxxxxxxxxxxxxxxxxxxxxxxx */
/* "Science is the game we play with God to find out what His rules are."  */

-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list