Merge lp:~elambert/drizzle/remove_rm_dir_symlink into lp:~drizzle-trunk/drizzle/development

Proposed by Eric Lambert
Status: Merged
Merged at revision: not available
Proposed branch: lp:~elambert/drizzle/remove_rm_dir_symlink
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: None lines
To merge this branch: bzr merge lp:~elambert/drizzle/remove_rm_dir_symlink
Reviewer Review Type Date Requested Status
Drizzle Developers Pending
Review via email: mp+7357@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Eric Lambert (elambert) wrote :

replaced call to db.cc:rm_dir_w_symlink with simple rmdir. Directories should no longer be sym-links so no need to handle sym-links

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'drizzled/db.cc'
--- drizzled/db.cc 2009-06-09 22:01:59 +0000
+++ drizzled/db.cc 2009-06-11 21:19:36 +0000
@@ -48,7 +48,6 @@
48 const char *db, const char *path,48 const char *db, const char *path,
49 TableList **dropped_tables);49 TableList **dropped_tables);
5050
51static bool rm_dir_w_symlink(const char *org_path);
52static void mysql_change_db_impl(Session *session, LEX_STRING *new_db_name);51static void mysql_change_db_impl(Session *session, LEX_STRING *new_db_name);
53 52
5453
@@ -586,9 +585,11 @@
586 if (dropped_tables)585 if (dropped_tables)
587 *dropped_tables= tot_list;586 *dropped_tables= tot_list;
588587
589 /* Don't give errors if we can't delete 'RAID' directory */588 if (rmdir(org_path))
590 if (rm_dir_w_symlink(org_path))589 {
590 my_error(ER_DB_DROP_RMDIR, MYF(0), org_path, errno);
591 return -1;591 return -1;
592 }
592593
593 return deleted;594 return deleted;
594595
@@ -597,58 +598,6 @@
597 return -1;598 return -1;
598}599}
599600
600
601/*
602 Remove directory with symlink
603
604 SYNOPSIS
605 rm_dir_w_symlink()
606 org_path path of derictory
607 RETURN
608 0 OK
609 1 ERROR
610*/
611
612static bool rm_dir_w_symlink(const char *org_path)
613{
614 char tmp_path[FN_REFLEN], *pos;
615 char *path= tmp_path;
616 unpack_filename(tmp_path, org_path);
617#ifdef HAVE_READLINK
618 int error;
619 char tmp2_path[FN_REFLEN];
620
621 /* Remove end FN_LIBCHAR as this causes problem on Linux in readlink */
622 pos= strchr(path, '\0');
623 if (pos > path && pos[-1] == FN_LIBCHAR)
624 *--pos=0;
625
626 if ((error= my_readlink(tmp2_path, path, MYF(MY_WME))) < 0)
627 return(1);
628 if (!error)
629 {
630 if (my_delete(path, MYF(MY_WME)))
631 {
632 return true;
633 }
634 /* Delete directory symbolic link pointed at */
635 path= tmp2_path;
636 }
637#endif
638 /* Remove last FN_LIBCHAR to not cause a problem on OS/2 */
639 pos= strchr(path, '\0');
640
641 if (pos > path && pos[-1] == FN_LIBCHAR)
642 *--pos=0;
643 if (rmdir(path) < 0)
644 {
645 my_error(ER_DB_DROP_RMDIR, MYF(0), path, errno);
646 return(1);
647 }
648 return(0);
649}
650
651
652/**601/**
653 @brief Internal implementation: switch current database to a valid one.602 @brief Internal implementation: switch current database to a valid one.
654603