DeviceOpener::Open() now returns the actual error instead of -1, as suggested
by Korli. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18727 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
7d4d702e05
commit
a847b384c6
@ -16,10 +16,11 @@
|
|||||||
#include <Drivers.h>
|
#include <Drivers.h>
|
||||||
#include <fs_volume.h>
|
#include <fs_volume.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
static const int32 kDesiredAllocationGroups = 56;
|
static const int32 kDesiredAllocationGroups = 56;
|
||||||
@ -78,6 +79,9 @@ int
|
|||||||
DeviceOpener::Open(const char *device, int mode)
|
DeviceOpener::Open(const char *device, int mode)
|
||||||
{
|
{
|
||||||
fDevice = open(device, mode);
|
fDevice = open(device, mode);
|
||||||
|
if (fDevice < 0)
|
||||||
|
fDevice = errno;
|
||||||
|
|
||||||
if (fDevice < 0 && mode == O_RDWR) {
|
if (fDevice < 0 && mode == O_RDWR) {
|
||||||
// try again to open read-only (don't rely on a specific error code)
|
// try again to open read-only (don't rely on a specific error code)
|
||||||
return Open(device, O_RDONLY);
|
return Open(device, O_RDONLY);
|
||||||
|
Loading…
Reference in New Issue
Block a user