Hi!
>>>>> "Yuri" == Yuri Dario <mc6530@stripped> writes:
Yuri> Hi Monty,
>> + char *pos=strend(path);
>> + if (pos > path && pos[-1] == FN_LIBCHAR)
>> + *--pos=0;
Yuri> but path is declared as 'const char *': so it is supposed to be
Yuri> read-only memory.
Yuri> Shouldn't be better to use strdup() and modify the copy?
Here is a now patch that you can apply to on my old patch...
===== sql/sql_db.cc 1.17 vs edited =====
*** sql/sql_db.cc-1.17 Wed Dec 6 01:54:17 2000
--- edited/sql/sql_db.cc Wed Dec 6 14:17:59 2000
***************
*** 158,171 ****
are 2 digits (raid directories).
*/
! static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *path,
! uint level)
{
long deleted=0;
ulong found_other_files=0;
char filePath[FN_REFLEN];
DBUG_ENTER("mysql_rm_known_files");
! DBUG_PRINT("enter",("path: %s", path));
/* remove all files with known extensions */
for (uint idx=2 ;
--- 158,171 ----
are 2 digits (raid directories).
*/
! static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *org_path,
! uint level)
{
long deleted=0;
ulong found_other_files=0;
char filePath[FN_REFLEN];
DBUG_ENTER("mysql_rm_known_files");
! DBUG_PRINT("enter",("path: %s", org_path));
/* remove all files with known extensions */
for (uint idx=2 ;
***************
*** 181,187 ****
{
char newpath[FN_REFLEN];
MY_DIR *new_dirp;
! strxmov(newpath,path,"/",file->name,NullS);
unpack_filename(newpath,newpath);
if ((new_dirp = my_dir(newpath,MYF(MY_DONT_SORT))))
{
--- 181,187 ----
{
char newpath[FN_REFLEN];
MY_DIR *new_dirp;
! strxmov(newpath,org_path,"/",file->name,NullS);
unpack_filename(newpath,newpath);
if ((new_dirp = my_dir(newpath,MYF(MY_DONT_SORT))))
{
***************
*** 199,205 ****
found_other_files++;
continue;
}
! strxmov(filePath,path,"/",file->name,NullS);
unpack_filename(filePath,filePath);
if (my_delete(filePath,MYF(MY_WME)))
{
--- 199,205 ----
found_other_files++;
continue;
}
! strxmov(filePath,org_path,"/",file->name,NullS);
unpack_filename(filePath,filePath);
if (my_delete(filePath,MYF(MY_WME)))
{
***************
*** 224,232 ****
*/
if (!found_other_files)
{
- #ifdef HAVE_READLINK
char tmp_path[FN_REFLEN];
! path=unpack_filename(tmp_path,path);
int linkcount = readlink(path,filePath,sizeof(filePath)-1);
if (linkcount > 0) // If the path was a symbolic link
{
--- 224,232 ----
*/
if (!found_other_files)
{
char tmp_path[FN_REFLEN];
! char *path=unpack_filename(tmp_path,org_path);
! #ifdef HAVE_READLINK
int linkcount = readlink(path,filePath,sizeof(filePath)-1);
if (linkcount > 0) // If the path was a symbolic link
{
Regards,
Monty