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:
Axel Dörfler 2006-08-31 17:26:13 +00:00
parent 7d4d702e05
commit a847b384c6

View File

@ -16,10 +16,11 @@
#include <Drivers.h>
#include <fs_volume.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static const int32 kDesiredAllocationGroups = 56;
@ -78,6 +79,9 @@ int
DeviceOpener::Open(const char *device, int mode)
{
fDevice = open(device, mode);
if (fDevice < 0)
fDevice = errno;
if (fDevice < 0 && mode == O_RDWR) {
// try again to open read-only (don't rely on a specific error code)
return Open(device, O_RDONLY);