diff options
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; |