diff options
author | Michael I. Bushnell <mib@gnu.org> | 1996-07-04 21:29:55 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1996-07-04 21:29:55 +0000 |
commit | e4f1c4fa49ed5a4147c834289d04cc3760c4373d (patch) | |
tree | 494bde009786bfee43696c6d6b10e824e45c6c8c | |
parent | f53c1f3ef6f55f6a7f83d8ed3a11d9af9f413af3 (diff) |
(netfs_S_io_write): Bother implementing O_APPEND.
-rw-r--r-- | libnetfs/io-write.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/libnetfs/io-write.c b/libnetfs/io-write.c index 81e47189..6c463c89 100644 --- a/libnetfs/io-write.c +++ b/libnetfs/io-write.c @@ -30,6 +30,7 @@ netfs_S_io_write (struct protid *user, mach_msg_type_number_t *amount) { error_t err; + off_t off = offset; if (!user) return EOPNOTSUPP; @@ -42,9 +43,24 @@ netfs_S_io_write (struct protid *user, } *amount = datalen; + + if (off == -1) + { + if (user->po->openstat & O_APPEND) + { + err = netfs_validate_stat (np, user->po->np); + if (err) + { + mutex_unlock (&user->po->np->lock); + return err; + } + user->po->filepointer = np->nn_stat.st_size; + } + off = user->po->filepointer; + } + err = netfs_attempt_write (user->credential, user->po->np, - offset == -1 ? user->po->filepointer : offset, - amount, data); + off, amount, data); if (offset == -1 && !err) user->po->filepointer += *amount; mutex_unlock (&user->po->np->lock); |