Fix handling of append.

This commit is contained in:
Michael Jumper 2013-11-05 00:37:23 -08:00
parent 52e65e043a
commit 3ebed6a85c

View File

@ -194,18 +194,18 @@ int guac_rdp_fs_open(guac_rdp_fs* fs, const char* path,
/* Translate access into flags */ /* Translate access into flags */
if (access & ACCESS_GENERIC_ALL) if (access & ACCESS_GENERIC_ALL)
flags = O_RDWR; flags = O_RDWR;
else if ((access & (ACCESS_GENERIC_WRITE | ACCESS_FILE_WRITE_DATA)) else if ((access & ( ACCESS_GENERIC_WRITE
| ACCESS_FILE_WRITE_DATA
| ACCESS_FILE_APPEND_DATA))
&& (access & (ACCESS_GENERIC_READ | ACCESS_FILE_READ_DATA))) && (access & (ACCESS_GENERIC_READ | ACCESS_FILE_READ_DATA)))
flags = O_RDWR; flags = O_RDWR;
else if (access & (ACCESS_GENERIC_WRITE | ACCESS_FILE_WRITE_DATA)) else if (access & ( ACCESS_GENERIC_WRITE
| ACCESS_FILE_WRITE_DATA
| ACCESS_FILE_APPEND_DATA))
flags = O_WRONLY; flags = O_WRONLY;
else else
flags = O_RDONLY; flags = O_RDONLY;
/* If append access requested, add appropriate option */
if (access & ACCESS_FILE_APPEND_DATA)
flags |= O_APPEND;
/* Normalize path, return no-such-file if invalid */ /* Normalize path, return no-such-file if invalid */
if (guac_rdp_fs_normalize_path(path, normalized_path)) { if (guac_rdp_fs_normalize_path(path, normalized_path)) {
GUAC_RDP_DEBUG(1, "Normalization of path \"%s\" failed.", path); GUAC_RDP_DEBUG(1, "Normalization of path \"%s\" failed.", path);