[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: texinfo (Re: Owl packages with dangerous "tmp" functions)
From: |
Solar Designer |
Subject: |
Re: texinfo (Re: Owl packages with dangerous "tmp" functions) |
Date: |
Thu, 4 Jan 2001 13:21:36 +0300 |
User-agent: |
Mutt/1.2.5i |
> - tempbase = mktemp (concat ("txiXXXXXX", "", ""));
> [snip]
> + tempdir = concat(tempdir, "txi.XXXXXX", "");
> + retries = 0x1000;
> + do
> + {
> + if (mktemp (tempdir) == NULL)
> + fatal ("mktemp: %s: %s", tempdir, strerror (errno));
> + if (mkdir (tempdir, 0700) == 0) break;
> + if (errno != EEXIST || !--retries)
> + fatal ("mkdir: %s: %s", tempdir, strerror (errno));
> + if ((dot = strrchr (tempdir, '.')))
> + strcpy (dot, ".XXXXXX");
> + }
> + while (1);
>
> This will break on systems with 8+3 limitations on file names (yes,
Yes, I actually have a "texindex.exe" on my DOS disk.
> Texinfo supports those systems). Why did you need the dot?
I didn't really need it, this is just more consistent with other
packages. I thought that "txiXXXXXX" was already 9 characters, so it
wouldn't matter if it's the DOS name or extension that's truncated?
> Also, isn't it better to use mkstemp, if that's available?
mkstemp creates files, not directories. There's mkdtemp, but it's
even less portable (added to glibc after 2.1).
> + atexit(flush_tempfiles_atexit);
>
> Can we depend on atexit be available on all supported platforms?
I believe so.
> > That other bug I mentioned is this:
> >
> > - sort_in_core (&tempfiles[i], MAX_IN_CORE_SORT, newtemp);
> > + sort_in_core (tempfiles[i], MAX_IN_CORE_SORT, newtemp);
>
> ??? Are you sure? sort_in_core accepts a "char **" as its first argument,
> while tempfiles[i] is a "char *".
Doesn't appear this way:
void
sort_in_core (infile, total, outfile)
char *infile;
and I actually had texindex crash reporting some pointers in place of
a filename it couldn't open before I've fixed this.
--
/sd