* in BEntry::SetTo and BFile::SetTo, we now support entry-refs with
  absolute names, too, just like R5 does


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30183 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe
2009-04-15 21:54:06 +00:00
parent 44e3e828a8
commit 0af6bceba4
2 changed files with 75 additions and 66 deletions
+4
View File
@@ -393,6 +393,10 @@ BEntry::SetTo(const entry_ref *ref, bool traverse)
if (ref == NULL) if (ref == NULL)
return (fCStatus = B_BAD_VALUE); return (fCStatus = B_BAD_VALUE);
// if ref-name is absolute, let the path-only SetTo() do the job
if (BPrivate::Storage::is_absolute_path(ref->name))
return SetTo(ref->name, traverse);
// open the directory and let set() do the rest // open the directory and let set() do the rest
int dirFD = _kern_open_dir_entry_ref(ref->device, ref->directory, NULL); int dirFD = _kern_open_dir_entry_ref(ref->device, ref->directory, NULL);
if (dirFD < 0) if (dirFD < 0)
+5
View File
@@ -16,6 +16,7 @@
#include <File.h> #include <File.h>
#include <fs_interface.h> #include <fs_interface.h>
#include <NodeMonitor.h> #include <NodeMonitor.h>
#include "storage_support.h"
#include <syscalls.h> #include <syscalls.h>
@@ -158,6 +159,10 @@ BFile::SetTo(const entry_ref *ref, uint32 openMode)
if (!ref) if (!ref)
return (fCStatus = B_BAD_VALUE); return (fCStatus = B_BAD_VALUE);
// if ref->name is absolute, let the path-only SetTo() do the job
if (BPrivate::Storage::is_absolute_path(ref->name))
return SetTo(ref->name, openMode);
openMode |= O_CLOEXEC; openMode |= O_CLOEXEC;
int fd = _kern_open_entry_ref(ref->device, ref->directory, ref->name, int fd = _kern_open_entry_ref(ref->device, ref->directory, ref->name,