1 |
signals 11/02/28 18:20:11 |
2 |
|
3 |
Added: xfe-1.32.2-destructive-move.patch |
4 |
Log: |
5 |
Fix #356683 |
6 |
|
7 |
(Portage version: 2.2.0_alpha25/cvs/Linux x86_64) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 x11-misc/xfe/files/xfe-1.32.2-destructive-move.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/x11-misc/xfe/files/xfe-1.32.2-destructive-move.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/x11-misc/xfe/files/xfe-1.32.2-destructive-move.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: xfe-1.32.2-destructive-move.patch |
16 |
=================================================================== |
17 |
Fixes bug #356683. Patch from upstream author. Thanks to |
18 |
genbug AT piments DOT com. |
19 |
|
20 |
--- src/File.cpp |
21 |
+++ src/File.cpp |
22 |
@@ -326,7 +326,7 @@ |
23 |
|
24 |
|
25 |
// Copy ordinary file |
26 |
-FXbool File::copyfile(const FXString& source, const FXString& target, const FXbool preserve_date) |
27 |
+FXint File::copyfile(const FXString& source, const FXString& target, const FXbool preserve_date) |
28 |
{ |
29 |
FXString destfile; |
30 |
FXuchar buffer[32768]; |
31 |
@@ -499,7 +499,6 @@ |
32 |
restartTimeout(); |
33 |
if(answer == BOX_CLICKED_CANCEL) |
34 |
{ |
35 |
- ::close(dst); |
36 |
::close(src); |
37 |
cancelled=TRUE; |
38 |
return FALSE; |
39 |
@@ -512,7 +511,7 @@ |
40 |
|
41 |
|
42 |
// Copy directory |
43 |
-FXbool File::copydir(const FXString& source,const FXString& target,struct stat& parentinfo,inodelist* inodes, const FXbool preserve_date) |
44 |
+FXint File::copydir(const FXString& source,const FXString& target,struct stat& parentinfo,inodelist* inodes, const FXbool preserve_date) |
45 |
{ |
46 |
DIR *dirp; |
47 |
struct dirent *dp; |
48 |
@@ -635,7 +634,7 @@ |
49 |
|
50 |
|
51 |
// Recursive copy |
52 |
-FXbool File::copyrec(const FXString& source,const FXString& target,inodelist* inodes, const FXbool preserve_date) |
53 |
+FXint File::copyrec(const FXString& source,const FXString& target,inodelist* inodes, const FXbool preserve_date) |
54 |
{ |
55 |
struct stat linfo1, linfo2; |
56 |
|
57 |
@@ -666,7 +665,7 @@ |
58 |
// Remove target if it already exists |
59 |
if (::exists(target)) |
60 |
{ |
61 |
- FXbool ret=File::remove(target); |
62 |
+ FXint ret=File::remove(target); |
63 |
if (!ret) |
64 |
return FALSE; |
65 |
} |
66 |
@@ -695,7 +694,7 @@ |
67 |
// Copy file (with progress dialog) |
68 |
// Return 0 to allow displaying an error message in the calling routine |
69 |
// Return -1 to prevent displaying an error message in the calling routine |
70 |
-FXbool File::copy(const FXString& source, const FXString& target, const FXbool confirm_dialog, const FXbool preserve_date) |
71 |
+FXint File::copy(const FXString& source, const FXString& target, const FXbool confirm_dialog, const FXbool preserve_date) |
72 |
{ |
73 |
FXString targetfile; |
74 |
|
75 |
@@ -793,7 +792,7 @@ |
76 |
|
77 |
|
78 |
// Remove file or directory (with progress dialog) |
79 |
-FXbool File::remove(const FXString& file) |
80 |
+FXint File::remove(const FXString& file) |
81 |
{ |
82 |
FXString dirname; |
83 |
struct stat linfo; |
84 |
@@ -935,7 +934,7 @@ |
85 |
// Rename a file or a directory (no progress dialog) |
86 |
// Return 0 to allow displaying an error message in the calling routine |
87 |
// Return -1 to prevent displaying an error message in the calling routine |
88 |
-FXbool File::rename(const FXString& source, const FXString& target) |
89 |
+FXint File::rename(const FXString& source, const FXString& target) |
90 |
{ |
91 |
// Source doesn't exist |
92 |
if(!::exists(source)) |
93 |
@@ -1002,7 +1001,7 @@ |
94 |
} |
95 |
|
96 |
// If files are on different file systems, use the copy/delete scheme and preserve the original date |
97 |
- FXbool ret=this->copy(source,target,FALSE,TRUE); |
98 |
+ FXint ret=this->copy(source,target,FALSE,TRUE); |
99 |
if (ret) |
100 |
return (remove(source.text())==TRUE); |
101 |
else |
102 |
@@ -1013,7 +1012,7 @@ |
103 |
// Move files |
104 |
// Return 0 to allow displaying an error message in the calling routine |
105 |
// Return -1 to prevent displaying an error message in the calling routine |
106 |
-FXbool File::move(const FXString& source,const FXString& target,const FXbool restore) |
107 |
+FXint File::move(const FXString& source,const FXString& target,const FXbool restore) |
108 |
{ |
109 |
// Source doesn't exist |
110 |
if(!::exists(source)) |
111 |
@@ -1031,6 +1030,16 @@ |
112 |
return -1; |
113 |
} |
114 |
|
115 |
+ // Source path is included into target path |
116 |
+ FXString str=source + PATHSEPSTRING; |
117 |
+ if (target.left(str.length()) == str) |
118 |
+ { |
119 |
+ forceTimeout(); |
120 |
+ MessageBox::error(this,BOX_OK,_("Error"),_("Source path %s is included into target path"),source.text()); |
121 |
+ return -1; |
122 |
+ |
123 |
+ } |
124 |
+ |
125 |
// Target is an existing directory (don't do this in the restore case) |
126 |
FXString targetfile; |
127 |
if (!restore && ::isDirectory(target)) |
128 |
@@ -1129,7 +1138,7 @@ |
129 |
targetfile=FXPath::directory(targetfile); |
130 |
|
131 |
// If files are on different file systems, use the copy/delete scheme and preserve the original date |
132 |
- FXbool ret=this->copy(source,targetfile,FALSE,TRUE); |
133 |
+ FXint ret=this->copy(source,targetfile,FALSE,TRUE); |
134 |
if (ret) |
135 |
return (remove(source.text())==TRUE); |
136 |
else |
137 |
@@ -1140,7 +1149,7 @@ |
138 |
// Symbolic Link file (no progress dialog) |
139 |
// Return 0 to allow displaying an error message in the calling routine |
140 |
// Return -1 to prevent displaying an error message in the calling routine |
141 |
-FXbool File::symlink(const FXString& source,const FXString& target) |
142 |
+FXint File::symlink(const FXString& source,const FXString& target) |
143 |
{ |
144 |
// Source doesn't exist |
145 |
if(!::exists(source)) |
146 |
--- src/File.h |
147 |
+++ src/File.h |
148 |
@@ -64,9 +64,9 @@ |
149 |
long fullread(FXint fd, FXuchar* ptr, long len); |
150 |
long fullwrite(FXint fd, const FXuchar* ptr, long len); |
151 |
FXuint getOverwriteAnswer(FXString, FXString); |
152 |
- FXbool copyfile(const FXString& source, const FXString& target, const FXbool preserve_date); |
153 |
- FXbool copyrec(const FXString& source,const FXString& target,inodelist* inodes, const FXbool preserve_date); |
154 |
- FXbool copydir(const FXString& source,const FXString& target,struct stat& parentstatus,inodelist* inodes, const FXbool preserve_date); |
155 |
+ FXint copyfile(const FXString& source, const FXString& target, const FXbool preserve_date); |
156 |
+ FXint copyrec(const FXString& source,const FXString& target,inodelist* inodes, const FXbool preserve_date); |
157 |
+ FXint copydir(const FXString& source,const FXString& target,struct stat& parentstatus,inodelist* inodes, const FXbool preserve_date); |
158 |
FXint rchmod(FXchar* path, FXchar* file, mode_t mode, const FXbool dironly, const FXbool fileonly); |
159 |
FXint rchown(FXchar* path, FXchar* file, uid_t uid, gid_t gid, const FXbool dironly, const FXbool fileonly); |
160 |
FXLabel *uplabel; |
161 |
@@ -107,11 +107,11 @@ |
162 |
restartTimeout(); |
163 |
} |
164 |
|
165 |
- FXbool copy(const FXString& source, const FXString& target, const FXbool confirm_dialog=TRUE, const FXbool preserve_date=TRUE); |
166 |
- FXbool rename(const FXString& source, const FXString& target); |
167 |
- FXbool move(const FXString& source, const FXString& target, const FXbool restore=FALSE); |
168 |
- FXbool symlink(const FXString& source, const FXString& target); |
169 |
- FXbool remove(const FXString& file); |
170 |
+ FXint copy(const FXString& source, const FXString& target, const FXbool confirm_dialog=TRUE, const FXbool preserve_date=TRUE); |
171 |
+ FXint rename(const FXString& source, const FXString& target); |
172 |
+ FXint move(const FXString& source, const FXString& target, const FXbool restore=FALSE); |
173 |
+ FXint symlink(const FXString& source, const FXString& target); |
174 |
+ FXint remove(const FXString& file); |
175 |
|
176 |
FXint chmod(FXchar* path, FXchar* file, mode_t mode, const FXbool rec, const FXbool dironly=FALSE, const FXbool fileonly=FALSE); |
177 |
FXint chown(FXchar* path, FXchar *file, uid_t uid, gid_t gid, const FXbool rec, const FXbool dironly=FALSE, const FXbool fileonly=FALSE); |