Re: pristine-tar: FTBFS on hurd-i386 (for review)
Svante Signell, le Tue 11 Feb 2014 18:52:28 +0100, a écrit :
> Maybe I got it wrong then, perhaps const would be better.
Const would mean you're preventing yourself from writing to it. But you
*want* to write to it with snprintf. Why do you believe you need to add
something else than char*?
> > Apart from that, it seems fine.
>
> New patch attached.
> @@ -540,10 +542,10 @@
> static void
> rebrain(char *zombie, char *program, int level)
> {
> - char path_buf[PATH_MAX];
> + char *path_buf = NULL;
Why setting it to NULL?
> char level_buf[3];
> char *argv[3];
> - int i;
> + int i, len;
>
> #if defined(__APPLE__) && defined(__MACH__)
> # define LD_PATH_VAR "DYLD_LIBRARY_PATH"
> @@ -551,9 +553,11 @@
> # define LD_PATH_VAR "LD_LIBRARY_PATH"
> #endif
>
> - snprintf(path_buf, sizeof(path_buf), "%s/%s", PKGLIBDIR, zombie);
> + len = strlen(PKGLIBDIR) + 1 + strlen(zombie) + 1;
That seems to be missing a malloc here, doesn't it?
> + snprintf(path_buf, len, "%s/%s", PKGLIBDIR, zombie);
> /* FIXME - should append, not overwrite */
> setenv(LD_PATH_VAR, path_buf, 1);
> + free(path_buf);
>
> snprintf(level_buf, sizeof(level_buf), "-%i", level);
>
Samuel
Reply to: