rsync 2.5.5 SCO Unixware patch

Dave Dykstra dwd at drdykstra.us
Tue Dec 24 13:27:00 EST 2002


On Mon, Dec 23, 2002 at 11:42:07PM -0800, Jos Backus wrote:
> On Mon, Dec 23, 2002 at 02:13:51PM -0800, Stephen Friedl wrote:
> > The change in popt/popt.c is to work around a bug in the SCO UNIXWare 8
> > compiler: it doesn't properly deal with alloca() being called from the
> > middle of another function call. The code dumps badly on this platform
> > with all modes (debug, regular, optimized), and the workaround shown
> > gets around the bug and likely obviates similar bugs on other platforms.
...
> > --- popt/popt.c.orig    Mon Dec 23 21:51:59 2002
> > +++ popt/popt.c Mon Dec 23 21:59:21 2002
> > @@ -443,9 +443,10 @@
> >             }
> >  
> >             /* Make a copy we can hack at */
> > -           localOptString = optString =
> > -                       strcpy(ALLOCA(strlen(origOptString) + 1),
> > -                       origOptString);
> > +           { int n = strlen(origOptString) + 1;
> > +             localOptString = optString = ALLOCA(n);
> > +             strcpy(optString, origOptString);
> > +           }
> >          
> >             if (!optString[0])
> >                 return POPT_ERROR_BADOPT;
...
> I don't feel brave enough to commit the popt/popt.c change without input from
> others.


The patch seems harmless, although I'm not sure it's the best style.
How about making strcpy a macro instead?  popt/popt.c is borrowed code,
and if we make modifications to it it might get forgotten the next time
it is upgraded.

- Dave Dykstra



More information about the rsync mailing list