]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fri Feb 16 18:23:15 IST 2007 Mark McLoughlin <markmc@redhat.com>
authorMark McLoughlin <markmc@redhat.com>
Fri, 16 Feb 2007 18:24:14 +0000 (18:24 +0000)
committerMark McLoughlin <markmc@redhat.com>
Fri, 16 Feb 2007 18:24:14 +0000 (18:24 +0000)
        * qemud/qemud.c: fix qemudEnableIpForwarding() to not leak
        an fd if writing to /proc/sys/net/ipv4/ip_forward fails.

ChangeLog
qemud/qemud.c

index f09ca92819d9940b9fe0a9385e567aeca3390f3d..b4bed7840135ea6e47ca48e626b36c840e54f14d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Feb 16 18:23:15 IST 2007 Mark McLoughlin <markmc@redhat.com>
+
+       * qemud/qemud.c: fix qemudEnableIpForwarding() to not leak
+       an fd if writing to /proc/sys/net/ipv4/ip_forward fails.
+       
 Fri Feb 16 11:56:24 EST 2007 Daniel P. Berrange <berrange@redhat.com>
 
        * tests/Makefile.am: Fixed linkage of test suites
index 24af96709f5c4567460ba6dbd97844ef3e10dc3d..4fb47fd30e85733a51f0f2ee010426460bc0e2fe 100644 (file)
@@ -980,15 +980,17 @@ qemudEnableIpForwarding(void)
 {
 #define PROC_IP_FORWARD "/proc/sys/net/ipv4/ip_forward"
 
-  int fd;
+    int fd, ret;
 
-  if ((fd = open(PROC_IP_FORWARD, O_WRONLY|O_TRUNC)) == -1 ||
-      write(fd, "1\n", 2) < 0)
-      return 0;
+    if ((fd = open(PROC_IP_FORWARD, O_WRONLY|O_TRUNC)) == -1)
+        return 0;
+
+    if (write(fd, "1\n", 2) < 0)
+        ret = 0;
 
-  close (fd);
+    close (fd);
 
-  return 1;
+    return 1;
 
 #undef PROC_IP_FORWARD
 }