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
1=== modified file 'drizzled/db.cc'
2--- drizzled/db.cc 2009-06-09 22:01:59 +0000
3+++ drizzled/db.cc 2009-06-11 21:19:36 +0000
4@@ -48,7 +48,6 @@
5 const char *db, const char *path,
6 TableList **dropped_tables);
7
8-static bool rm_dir_w_symlink(const char *org_path);
9 static void mysql_change_db_impl(Session *session, LEX_STRING *new_db_name);
10
11
12@@ -586,9 +585,11 @@
13 if (dropped_tables)
14 *dropped_tables= tot_list;
15
16- /* Don't give errors if we can't delete 'RAID' directory */
17- if (rm_dir_w_symlink(org_path))
18+ if (rmdir(org_path))
19+ {
20+ my_error(ER_DB_DROP_RMDIR, MYF(0), org_path, errno);
21 return -1;
22+ }
23
24 return deleted;
25
26@@ -597,58 +598,6 @@
27 return -1;
28 }
29
30-
31-/*
32- Remove directory with symlink
33-
34- SYNOPSIS
35- rm_dir_w_symlink()
36- org_path path of derictory
37- RETURN
38- 0 OK
39- 1 ERROR
40-*/
41-
42-static bool rm_dir_w_symlink(const char *org_path)
43-{
44- char tmp_path[FN_REFLEN], *pos;
45- char *path= tmp_path;
46- unpack_filename(tmp_path, org_path);
47-#ifdef HAVE_READLINK
48- int error;
49- char tmp2_path[FN_REFLEN];
50-
51- /* Remove end FN_LIBCHAR as this causes problem on Linux in readlink */
52- pos= strchr(path, '\0');
53- if (pos > path && pos[-1] == FN_LIBCHAR)
54- *--pos=0;
55-
56- if ((error= my_readlink(tmp2_path, path, MYF(MY_WME))) < 0)
57- return(1);
58- if (!error)
59- {
60- if (my_delete(path, MYF(MY_WME)))
61- {
62- return true;
63- }
64- /* Delete directory symbolic link pointed at */
65- path= tmp2_path;
66- }
67-#endif
68- /* Remove last FN_LIBCHAR to not cause a problem on OS/2 */
69- pos= strchr(path, '\0');
70-
71- if (pos > path && pos[-1] == FN_LIBCHAR)
72- *--pos=0;
73- if (rmdir(path) < 0)
74- {
75- my_error(ER_DB_DROP_RMDIR, MYF(0), path, errno);
76- return(1);
77- }
78- return(0);
79-}
80-
81-
82 /**
83 @brief Internal implementation: switch current database to a valid one.
84