Handle other write flags, log and handler read/write errors.
This commit is contained in:
parent
582e1a60b3
commit
c70efcea4d
@ -140,9 +140,10 @@ int guac_rdpdr_fs_open(guac_rdpdr_device* device,
|
||||
/* Translate access into mode */
|
||||
if (access & ACCESS_GENERIC_ALL)
|
||||
mode = O_RDWR;
|
||||
else if (access & (ACCESS_GENERIC_WRITE | ACCESS_GENERIC_READ))
|
||||
else if ((access & (ACCESS_GENERIC_WRITE | ACCESS_FILE_WRITE_DATA))
|
||||
&& (access & (ACCESS_GENERIC_READ | ACCESS_FILE_READ_DATA)))
|
||||
mode = O_RDWR;
|
||||
else if (access & ACCESS_GENERIC_WRITE)
|
||||
else if (access & (ACCESS_GENERIC_WRITE | ACCESS_FILE_WRITE_DATA))
|
||||
mode = O_WRONLY;
|
||||
else
|
||||
mode = O_RDONLY;
|
||||
|
@ -42,6 +42,7 @@
|
||||
#endif
|
||||
|
||||
#include <guacamole/pool.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "rdpdr_fs.h"
|
||||
#include "rdpdr_fs_messages.h"
|
||||
@ -184,6 +185,8 @@ void guac_rdpdr_fs_process_read(guac_rdpdr_device* device,
|
||||
|
||||
/* If error, return invalid parameter */
|
||||
if (bytes_read < 0) {
|
||||
guac_client_log_error(device->rdpdr->client,
|
||||
"Unable to read from file: %s", strerror(errno));
|
||||
Stream_Write_UINT32(output_stream, STATUS_INVALID_PARAMETER);
|
||||
Stream_Write_UINT32(output_stream, 0); /* Length */
|
||||
}
|
||||
@ -249,7 +252,10 @@ void guac_rdpdr_fs_process_write(guac_rdpdr_device* device,
|
||||
|
||||
/* If error, return invalid parameter */
|
||||
if (bytes_written < 0) {
|
||||
Stream_Write_UINT32(output_stream, STATUS_INVALID_PARAMETER);
|
||||
guac_client_log_error(device->rdpdr->client,
|
||||
"Unable to write to file %i: %s", file->fd,
|
||||
strerror(errno));
|
||||
Stream_Write_UINT32(output_stream, STATUS_ACCESS_DENIED);
|
||||
Stream_Write_UINT32(output_stream, 0); /* Length */
|
||||
}
|
||||
|
||||
|
@ -207,6 +207,7 @@
|
||||
#define STATUS_INVALID_PARAMETER 0xC000000D
|
||||
#define STATUS_NO_SUCH_FILE 0xC000000F
|
||||
#define STATUS_END_OF_FILE 0xC0000011
|
||||
#define STATUS_ACCESS_DENIED 0xC0000022
|
||||
#define STATUS_FILE_INVALID 0xC0000098
|
||||
#define STATUS_FILE_IS_A_DIRECTORY 0xC00000BA
|
||||
#define STATUS_TOO_MANY_OPENED_FILES 0xC000011F
|
||||
|
Loading…
Reference in New Issue
Block a user