On Fri, Jul 18, 2003 at 06:11:30PM +0200, PUYDT Julien wrote:
> this long patch is supposed to make hello.c correct and "robust"... it
> includes the previously posted patch.
>
> Notice that in storeio, trivfs_S_io_seek uses open_seek, which doesn't
> check the offset sanity either; I'll take a look at it when I'll have
> understood things a little more.
There are more places where this check doesn't exist.
> +kern_return_t
> +trivfs_S_io_get_openmodes (struct trivfs_protid *cred,
> + mach_port_t reply,
> + mach_msg_type_name_t replytype,
> + int *bits)
> +{
> + if (!cred)
> + return EOPNOTSUPP;
> + else
> + {
> + *bits = cred->po->openmodes;
> + return 0;
> + }
> +}
This function is the same as the one in libtrivfs, no need to duplicate it.
> +kern_return_t
> +trivfs_S_io_clear_some_openmodes (struct trivfs_protid *cred,
> + mach_port_t reply,
> + mach_msg_type_name_t replytype,
> + int bits)
> +{
> + return EOPNOTSUPP;
> +}
> +
> +kern_return_t
> +trivfs_S_io_set_some_openmodes (struct trivfs_protid *cred,
> + mach_port_t reply,
> + mach_msg_type_name_t replytype,
> + int bits)
> +{
> + return EOPNOTSUPP;
> +}
> +
> +error_t
> +trivfs_S_io_set_all_openmodes (struct trivfs_protid *cred,
> + mach_port_t reply,
> + mach_msg_type_name_t replytype,
> + int mode)
> +{
> + return EOPNOTSUPP;
> +}
These should return EOPNOTSUPP when !cred and 0 otherwise.
> +kern_return_t
> +trivfs_S_io_readable (struct trivfs_protid *cred,
> + mach_port_t reply,
> + mach_msg_type_name_t replytype,
> + mach_msg_type_number_t *amount)
> +{
> + struct open *op;
> +
> + if (!cred)
> + return EOPNOTSUPP;
> +
> + if(! (cred->po->openmodes & O_READ))
> + return EINVAL;
This should return EBADF instead of EINVAL.
> + op=cred->po->hook;
> + *amount=contents_len - op->offs;
You forgot spaces around the "=".
> + return 0;
> +
> +}
> +
> +kern_return_t
> +trivfs_S_io_select (struct trivfs_protid *cred,
> + mach_port_t reply,
> + mach_msg_type_name_t replytype,
> + int *seltype)
> +{
> + if (!cred)
> + return EOPNOTSUPP;
> +
> + if ((*seltype & SELECT_READ) && !(cred->po->openmodes & O_READ))
> + return EBADF;
I'm not sure if this is right, somebody else should comment on that.
> + *seltype &= ~SELECT_URG;
> + *seltype &= ~SELECT_WRITE;
> +
> + return 0;
> +}
Jeroen Dekkers
_______________________________________________
Bug-hurd mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-hurd