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

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



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.


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