Hi!
>>>>> "Yuri" == Yuri Dario <mc6530@stripped> writes:
Yuri> Hi,
Yuri> mysqladmin drop db is failing under OS/2 with
Yuri> E:\usr\local\mysql\bin\mysqladmin.exe: drop of 'test' failed;
Yuri> error: 'Error dropping database (can't rmdir '.\test\', errno: 2)'
Yuri> that's because mysql_rm_known_files() in sql_db.cc is calling rmdir()
Yuri> using an ending slash for the directory name. Unfortunately the C
Yuri> library doesn't accept ending \ or /, so the call fail.
Yuri> Is there a function to call to fix paths, or I have to code it myself?
Yuri> in my idea, it will replace the ending \ with a \0.
Yuri> TIA,
I have now fixed this for MySQL 3.23.29; Here is the patch for this:
===== sql_db.cc 1.16 vs edited =====
*** sql_db.cc-1.16 Tue Sep 26 00:33:07 2000
--- edited/sql_db.cc Wed Dec 6 01:27:05 2000
***************
*** 182,187 ****
--- 182,188 ----
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))))
{
DBUG_PRINT("my",("New subdir found: %s", newpath));
***************
*** 199,204 ****
--- 200,206 ----
continue;
}
strxmov(filePath,path,"/",file->name,NullS);
+ unpack_filename(filePath,filePath);
if (my_delete(filePath,MYF(MY_WME)))
{
net_printf(&thd->net,ER_DB_DROP_DELETE,filePath,my_error);
***************
*** 223,228 ****
--- 225,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
{
***************
*** 238,243 ****
--- 242,251 ----
path=filePath;
}
#endif
+ /* Remove last FN_LIBCHAR to not cause a probelm on OS/2 */
+ char *pos=strend(path);
+ if (pos > path && pos[-1] == FN_LIBCHAR)
+ *--pos=0;
/* Don't give errors if we can't delete 'RAID' directory */
if (rmdir(path) < 0 && !level)
{
Regards,
Monty