Fixed a bug that would have considered /boot/trashy_file be in /boot/trash.
Spotted by Rene, thanks! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39805 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -131,10 +131,13 @@ bool DeskbarView::_EntryInTrash(const entry_ref* entry)
|
|||||||
BPath trashPath;
|
BPath trashPath;
|
||||||
BPath entryPath(entry);
|
BPath entryPath(entry);
|
||||||
BVolume volume(entry->device);
|
BVolume volume(entry->device);
|
||||||
if (volume.InitCheck() == B_OK) {
|
if (volume.InitCheck() == B_OK
|
||||||
find_directory(B_TRASH_DIRECTORY, &trashPath, false, &volume);
|
&& find_directory(B_TRASH_DIRECTORY, &trashPath, false,
|
||||||
if (strncmp(entryPath.Path(), trashPath.Path(),
|
&volume) == B_OK) {
|
||||||
strlen(trashPath.Path())) == 0)
|
char path[PATH_MAX];
|
||||||
|
strncpy(path, trashPath.Path(), sizeof(path));
|
||||||
|
strncat(path, "/", sizeof(path));
|
||||||
|
if (strncmp(entryPath.Path(), path, strlen(path)) == 0)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -638,10 +638,13 @@ MailDaemonApp::_IsEntryInTrash(BEntry& entry)
|
|||||||
BPath trashPath;
|
BPath trashPath;
|
||||||
BPath entryPath(&entry);
|
BPath entryPath(&entry);
|
||||||
BVolume volume(ref.device);
|
BVolume volume(ref.device);
|
||||||
if (volume.InitCheck() == B_OK) {
|
if (volume.InitCheck() == B_OK
|
||||||
find_directory(B_TRASH_DIRECTORY, &trashPath, false, &volume);
|
&& find_directory(B_TRASH_DIRECTORY, &trashPath,
|
||||||
if (strncmp(entryPath.Path(), trashPath.Path(),
|
false, &volume) == B_OK) {
|
||||||
strlen(trashPath.Path())) == 0)
|
char path[PATH_MAX];
|
||||||
|
strncpy(path, trashPath.Path(), sizeof(path));
|
||||||
|
strncat(path, "/", sizeof(path));
|
||||||
|
if (strncmp(entryPath.Path(), path, strlen(path)) == 0)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user