[PATCH] Fix bug in proxy_write()

David Woodhouse dwmw2 at infradead.org
Sat Feb 8 11:44:20 EST 2014


On Sat, 2014-02-08 at 23:10 +0800, Antonio Borneo wrote:
> 
> Actually proxy_write() is used also for regular files
> in run_csd_script():
>         fd = mkstemp(fname);
>         ...
>         ret = proxy_write(vpninfo, fd, (void *)buf, buflen);


Hm, do we actually need to use proxy_write() here? Adam did that in
commit cc09a51eb — quite possibly at my instigation.

In *theory* we should loop on write() to regular files because it can
return having written fewer bytes than we asked. But in practice it will
never happen, and most userspace would break if it did.

Still, while it was essentially "free" to do the right thing, it made a
certain amount of sense to be anal about it and to use proxy_write().

But once we have to start jumping through hoops to make proxy_write()
choose whether to do write() or send(), perhaps the better answer is
just to use a simple write() in run_csd_script() to write to the file?

-- 
dwmw2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5745 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/openconnect-devel/attachments/20140208/406eaf43/attachment.bin>


More information about the openconnect-devel mailing list