make-w32
[Top][All Lists]
Advanced

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

Re: Make CVS HEAD version build out of the box


From: Yongwei Wu
Subject: Re: Make CVS HEAD version build out of the box
Date: Tue, 2 Oct 2007 19:57:10 +0800

On 02/10/2007, Eli Zaretskii <address@hidden> wrote:
> > Date: Mon, 01 Oct 2007 22:34:30 +0200
> > From: Eli Zaretskii <address@hidden>
> > Cc: address@hidden
> >
> > It's valid C, allright, but the code clearly wants not to modify the
> > `name' argument to the function, and the function's prototype promises
> > that it won't be modified.  So modifying it would be a breach of
> > contract between the function and its callers.  If, for example, at
> > some point, `find_directory' is passed a constant string literal as
> > its argument, Make could crash at run time.
> >
> > I will suggest an alternative patch in a while.
>
> Here's my suggestion.  Could Yongwei Wu please test this and see if it
> works?
[patch snipped]

The patch itself is good.  Can I suggest a small alternative?

--- dir.c.bak   2007-10-02 19:33:52.281250000 +0800
+++ dir.c       2007-10-02 19:35:35.656250000 +0800
@@ -457,10 +457,11 @@
       r = vmsstat_dir (name, &st);
 #elif defined(WINDOWS32)
       {
-       char tem[MAXPATHLEN], *t;
+       char *tem, *t;

        /* Remove any trailing slashes.  Windows32 stat fails even on
           valid directories if they end in a slash. */
+       tem = alloca (p - name + 1);
        memcpy (tem, name, p - name + 1);
        t = tem + (p - name - 1);
        if (*t == '/' || *t == '\\')

Best regards,

Yongwei

-- 
Wu Yongwei
URL: http://wyw.dcweb.cn/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]