On 02/10/2007, Eli Zaretskii <[EMAIL PROTECTED]> wrote:
> > Date: Mon, 01 Oct 2007 22:34:30 +0200
> > From: Eli Zaretskii <[EMAIL PROTECTED]>
> > Cc: [email protected]
> >
> > 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/
_______________________________________________
Make-w32 mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/make-w32