summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjguiban2013-07-17 09:20:57 (EDT)
committerEugene Tarassov2013-07-18 02:29:16 (EDT)
commite76f2403de87af314a3220ec58f1a05d5e96cbc5 (patch)
tree4fd17d55d3017c83d84404505e910e92f0609286
parentaa2dc01f2c691ea34b8a0166a70ad117898bf6ec (diff)
downloadorg.eclipse.tcf.agent-e76f2403de87af314a3220ec58f1a05d5e96cbc5.zip
org.eclipse.tcf.agent-e76f2403de87af314a3220ec58f1a05d5e96cbc5.tar.gz
org.eclipse.tcf.agent-e76f2403de87af314a3220ec58f1a05d5e96cbc5.tar.bz2
FileSystem service; Fix mapping of O_RDWR flag
Signed-off-by: jguiban <jerome.guiban@windriver.com>
-rw-r--r--agent/tcf/services/filesystem.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/agent/tcf/services/filesystem.c b/agent/tcf/services/filesystem.c
index d4bcef8..d06edaf 100644
--- a/agent/tcf/services/filesystem.c
+++ b/agent/tcf/services/filesystem.c
@@ -356,8 +356,11 @@ static void write_file_attrs(OutputStream * out, FileAttrs * attrs) {
static int to_local_open_flags(int flags) {
int res = O_BINARY | O_LARGEFILE;
- if (flags & TCF_O_READ) res |= O_RDONLY;
- if (flags & TCF_O_WRITE) res |= O_WRONLY;
+ if ((flags & TCF_O_READ) && (flags & TCF_O_WRITE))
+ res |= O_RDWR;
+ else if (flags & TCF_O_READ) res |= O_RDONLY;
+ else if (flags & TCF_O_WRITE) res |= O_WRONLY;
+
if (flags & TCF_O_APPEND) res |= O_APPEND;
if (flags & TCF_O_CREAT) res |= O_CREAT;
if (flags & TCF_O_TRUNC) res |= O_TRUNC;