[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
id-utils 3.2d bug and fix
From: |
Cynbe ru Taren |
Subject: |
id-utils 3.2d bug and fix |
Date: |
Tue, 25 Jan 2005 12:07:31 -0600 |
First, trivially, in the id-utils distro README file,
<address@hidden>.
should be changed to
<address@hidden>.
Second, micha <address@hidden> correctly reports
if looking at mkid --help this should work:
cd /usr/include
mkid -o ~/test
or
mkid -o $HOME/test /usr/include
but this fails with:
mkid: can't create `/home/micha': Is a directory
???? this is wrong, the dest-filename is $HOME/test and it can be created...
( /home/micha is my home-dir )
this works:
cd ~
mkid -o test /usr/include
I'm not sure wether the handling of the -o or -f option is right...
The problem is in mkid.c:assert_writeable () which
incorrectly assumes that dirname() is side-effect free.
Substituting the following version of the subroutine
(which gives dirname() a temporary copy of the filename
to munge, leaving the original string unchanged) fixes
the problem:
void
assert_writeable (char const *untouchable_file_name )
{
/* Make private copy of untouchable_file_name so */
/* dirname() side-effects won't escape this fn: */
char* file_name = MALLOC (char, strlen(untouchable_file_name)+1 );
strcpy( file_name, untouchable_file_name );
if (access (file_name, 06) < 0)
{
if (errno == ENOENT)
{
/* On Linux, at least, dirname() writes */
/* a nul into its input string: */
char const *dir_name = dirname (file_name);
if (!dir_name || !*dir_name)
dir_name = ".";
if (access (dir_name, 06) < 0)
error (1, errno, _("can't create `%s' in `%s'"),
basename (untouchable_file_name), dir_name);
}
else
error (1, errno, _("can't modify `%s'"), file_name);
}
free( file_name );
}
(FWIW, I checked the other source files in the
package, and found no other uses of dirname().)
Thanks to everyone concerned for a great little utility!
Life is Good,
-- Cynbe
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- id-utils 3.2d bug and fix,
Cynbe ru Taren <=