Commits


document wstat


add a note about the `size' field in stat


shrink stat table listing


9pclib: fix qid serialization twstat was serializing the qid in the wrong order. While here, add a comment before the qid definition too.


ftp: truncate the file in woc_file The idea behind woc_file is to create or open a file, but it's always used for writing fresh new content, so it's actually an error that it opens a file for writing without truncating it too. It means that if we write less content than what the file already has, we kepp garbage at the end. This adds an extra argument in send_fid (that is actually used only from woc_file now) so that we can pass KOTRUNC for do_open.


fix memory leak in walk_path error path found by clang' static-analyzer


- [regress-extra] added testing for changing atime and mtime using wstat.


- [regress-extra] refactored test related to file moving or truncation.


9pclib: send size in wstat This is the counterpart for the recent kamid commit about wstat: we're lacking the leading size field.


wstat: missing read for size 9p stat message have a leading 2 bytes long size field. It's meant to simplify the parsing, because while reading the contents of a directory it's necessary to know how much long an entry is, so the length field is present even in the Rstat reply and in the Twstat input. Previously we didn't consume that bit and thus mis-read all of the following fields.


kamid: simplify "not a directory" check


fix compilation: struct np_stat is defined in kami.h


- [regress-extra] added test for checking truncation of files using Twstat.


work around wstat limitation the previous commit added an explicit check for extra data in messages. The problem is that wstat voluntarily skips reading some fields at the end, so the len will always be greater than zero!


fail if the received packet is too long This adds extra checks to every t* function: if the client sent too much data per message, treat is an a protocol violation and terminate the connection. Regress suite still passes, this is just an extra safety check for finding wrong clients implementations. The twrite function was the only one with a check like this.