NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/41494
On Wed May 27 2009 at 18:50:17 +0200, Nicolas Joly wrote:
> > Try if this helps this:
>
> No luck ... But this slightly modified version make the following
> command successful.
>
> find /mnt -type f | xargs cat
Duh, I meant "strlen(localbuf) == offset+1". But I soon did realize
that the check should be "<", since the file might shrink in size between
two reads.
It's still a little busted, since there's a race where the artificial \n
doesn't get included. But I doubt that's worth caring about, since it
requires modifying the underlying sysctl in the middle of two operations.
> Index: sysctlfs.c
> ===================================================================
> RCS file: /cvsroot/src/usr.sbin/puffs/mount_sysctlfs/sysctlfs.c,v
> retrieving revision 1.10
> diff -u -p -r1.10 sysctlfs.c
> --- sysctlfs.c 18 Jan 2009 10:10:47 -0000 1.10
> +++ sysctlfs.c 27 May 2009 16:41:29 -0000
> @@ -627,7 +627,10 @@ sysctlfs_node_read(struct puffs_usermoun
> return EISDIR;
>
> doprint(sfs, &pn->pn_po, localbuf, sizeof(localbuf));
> - xfer = MIN(*resid, strlen(localbuf) - offset);
> + if (strlen(localbuf) < offset)
> + xfer = 0;
> + else
> + xfer = MIN(*resid, strlen(localbuf) - offset);
>
> if (xfer <= 0)
> return 0;
>
>
> --
> Nicolas Joly
>
> Biological Software and Databanks.
> Institut Pasteur, Paris.
Home |
Main Index |
Thread Index |
Old Index