Re: [libvirt] [PATCH 2/4] New utility functions virFileCreate and virDirCreate

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

 



On 01/20/2010 03:05 PM, Daniel Veillard wrote:
On Wed, Jan 20, 2010 at 02:29:41AM -0500, Laine Stump wrote:
+                             path);
+        goto error;
+    }
+    if (fstat(fd,&st) == -1) {
+        ret = errno;
+        virReportSystemError(NULL, errno, _("stat of '%s' failed"), path);
   misses a close(fd); here

+        goto error;
+    }

Oops! To make it more difficult to do that again in the future, I've changed it so that fd is initialized to -1, reset to -1 after close is called in the non-error path, and I check for it after error:.


ACK, but there is the small fd leak to plug

Revised patch following momentarily.

--
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]