On 11/24/2015 10:52 AM, Marc-André Lureau wrote: > Hi > > ----- Original Message ----- >> On 11/24/2015 09:34 AM, marcandre.lur...@redhat.com wrote: >>> From: Marc-André Lureau <marcandre.lur...@redhat.com> >> >> In the subject: s/implicitely/implicitly/ if you are fixing the typo, or >> s/implicitely/explicitly/ if you are trying to make it match what the >> patch actually does. >> > > ok, I'll switch to explicitely (it depends on the point of view, I was > commenting from the qga API user pov, but I get your point)
I was trying to point out not only the 2 points of view, but also the typo (it's explicitly, not explicitely) :) >>> fh = gfh->fh; >>> + >>> + if (!gfh->writing) { >>> + int ret = fseek(fh, 0, SEEK_CUR); >> >> Seems a bit odd to use fflush() in one place and fseek() in the other, >> but the net result is the same either way. > > "and input is not directly followed by output without an intervening call to > a file positioning function, unless the input operation encounters > end-of-file." > > so I tried to follow what the spec said. POSIX currently specifies the behavior of fflush() on seekable input files, but did not always do so; and it has been a source of bugs on several libc implementations (it is still undefined to use fflush() on a non-seekable file, but I don't know if anyone is using qga guest-file-* on non-seekable files, at least in a situation where they are both reading and writing to the same file handle). So on further thought, I actually prefer avoiding fflush() after input when possible, to avoid confusing older libc, and as a result, your asymmetry is probably the best choice after all. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature