closing #3773:
* 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:
@@ -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)
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user