#endif
#include "config.h"
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
if (file->is_dir)
{
if (mkdir(file->fullpath, mode) != 0)
- return False;
+ {
+ file->err = errno;
+ return True;
+ }
}
exists = False;
}
{
file->dir = opendir(file->fullpath);
if (file->dir == NULL)
- return False;
+ {
+ file->err = errno;
+ return True;
+ }
}
else
{
file->fd = open(file->fullpath, oflag, mode);
if (file->fd == -1)
- return False;
+ {
+ file->err = errno;
+ return True;
+ }
}
return True;
*/
#include "config.h"
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
freerdp_thread* thread;
};
+
+static uint32
+disk_map_posix_err(int fs_errno)
+{
+ uint32 rc;
+
+ /* try to return NTSTATUS version of error code */
+ switch (fs_errno)
+ {
+ case EPERM:
+ case EACCES:
+ rc = STATUS_ACCESS_DENIED;
+ break;
+ case ENOENT:
+ rc = STATUS_NO_SUCH_FILE;
+ break;
+ case EBUSY:
+ rc = STATUS_DEVICE_BUSY;
+ break;
+ case EEXIST:
+ rc = STATUS_OBJECT_NAME_COLLISION;
+ break;
+ case EISDIR:
+ rc = STATUS_FILE_IS_A_DIRECTORY;
+ break;
+
+ default:
+ rc = STATUS_UNSUCCESSFUL;
+ break;
+ }
+ DEBUG_SVC("errno 0x%x mapped to 0x%x\n", fs_errno, rc);
+ return rc;
+}
+
static DISK_FILE* disk_get_file_by_id(DISK_DEVICE* disk, uint32 id)
{
LIST_ITEM* item;
DEBUG_WARN("failed to create %s.", path);
}
+ else if (file->err)
+ {
+ FileId = 0;
+ Information = 0;
+
+ /* map errno to windows result*/
+ irp->IoStatus = disk_map_posix_err(file->err);
+
+ disk_file_free(file);
+ }
else
{
list_enqueue(disk->files, file);