diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-05-07 16:15:57 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-05-11 13:58:43 +0200 |
commit | d61b0a5abfb00abf91ef281a89cb3984b5eef737 (patch) | |
tree | 2b22fcb26252f721a3e7c3b1a75e8e63dd743a68 /cpukit/libfs/src/imfs/memfile.c | |
parent | Filesystem: PR1398: Fix lseek() mechanic (diff) | |
download | rtems-d61b0a5abfb00abf91ef281a89cb3984b5eef737.tar.bz2 |
Filesystem: PR1871: Fix O_APPEND
Diffstat (limited to 'cpukit/libfs/src/imfs/memfile.c')
-rw-r--r-- | cpukit/libfs/src/imfs/memfile.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/cpukit/libfs/src/imfs/memfile.c b/cpukit/libfs/src/imfs/memfile.c index 64679df037..d836172884 100644 --- a/cpukit/libfs/src/imfs/memfile.c +++ b/cpukit/libfs/src/imfs/memfile.c @@ -92,7 +92,7 @@ int memfile_open( /* * Perform 'copy on write' for linear files */ - if ((iop->flags & (LIBIO_FLAGS_WRITE | LIBIO_FLAGS_APPEND)) + if ((iop->flags & LIBIO_FLAGS_WRITE) && (IMFS_type( the_jnode ) == IMFS_LINEAR_FILE)) { uint32_t count = the_jnode->info.linearfile.size; const unsigned char *buffer = the_jnode->info.linearfile.direct; @@ -106,8 +106,6 @@ int memfile_open( && (IMFS_memfile_write(the_jnode, 0, buffer, count) == -1)) return -1; } - if (iop->flags & LIBIO_FLAGS_APPEND) - iop->offset = the_jnode->info.file.size; return 0; } @@ -146,6 +144,9 @@ ssize_t memfile_write( the_jnode = iop->pathinfo.node_access; + if ((iop->flags & LIBIO_FLAGS_APPEND) != 0) + iop->offset = the_jnode->info.file.size; + status = IMFS_memfile_write( the_jnode, iop->offset, buffer, count ); return status; |