Re: [PATCH v3] bye to close(), welcome to VIR_(FORCE_)CLOSE()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/09/2010 05:58 AM, Daniel P. Berrange wrote:
On Mon, Nov 08, 2010 at 03:17:56PM -0700, Eric Blake wrote:
Index: libvirt-acl/src/libvirt.c
===================================================================
--- libvirt-acl.orig/src/libvirt.c
+++ libvirt-acl/src/libvirt.c
@@ -10794,7 +10794,7 @@ virStreamRef(virStreamPtr stream)
   *      ... report an error ....
   * done:
   *   virStreamFree(st);
- *   close(fd);
+ *   VIR_FORCE_CLOSE(fd);
   *
   * Returns the number of bytes written, which may be less
   * than requested.
@@ -10884,8 +10884,8 @@ error:
   *      ... report an error ....
   * done:
   *   virStreamFree(st);
- *   close(fd);
- *
+ *   if (VIR_CLOSE(fd)<  0)
+ *       virReportSystemError(errno, "%s", _("failed to close file"));
   *
   * Returns the number of bytes read, which may be less
   * than requested.
@@ -10964,7 +10964,7 @@ error:
   *   if (virStreamFinish(st)<  0)
   *      ...report an error...
   *   virStreamFree(st);
- *   close(fd);
+ *   VIR_FORCE_CLOSE(fd);
   *
   * Returns 0 if all the data was successfully sent. The caller
   * should invoke virStreamFinish(st) to flush the stream upon
These first three are okay.

@@ -11061,7 +11061,7 @@ cleanup:
   *   if (virStreamFinish(st)<  0)
   *      ...report an error...
   *   virStreamFree(st);
- *   close(fd);
+ *   VIR_FORCE_CLOSE(fd);
But the comment for virStreamRecvAll should match the comment for
virStreamRecv.  (Comments only, so trivial to fix).

None of these comments should be changed. They are illustrating how to
use the libvirt public API from application code. Application code
will not have VIR_CLOSE/VIR_FORCE_CLOSE since that's libvirt internal
stuff.
I'll entirely cut out the changes to this file.

   Stefan

Regards,
Daniel

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]