qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2] Support for UDP unicast network backend


From: Benjamin
Subject: Re: [Qemu-devel] [PATCH v2] Support for UDP unicast network backend
Date: Wed, 30 Nov 2011 02:29:50 +0900
User-agent: Mozilla/5.0 (X11; OpenBSD i386; rv:5.0) Gecko/20110815 Thunderbird/5.0

On 11/28/11 20:39, Stefan Hajnoczi wrote:
On Fri, Nov 25, 2011 at 12:49 PM, Benjamin<address@hidden>  wrote:
+    fd = qemu_socket(PF_INET, SOCK_DGRAM, 0);
+    if (fd<  0) {
+        perror("socket(PF_INET, SOCK_DGRAM)");
+        return -1;
+    }
+    val = 1;
+    ret = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
+                   (const char *)&val, sizeof(val));
+    if (ret<  0) {
+        perror("setsockopt(SOL_SOCKET, SO_REUSEADDR)");

Please avoid leaking the file descriptor on error:
closesocket(fd);

Since existing code also does this it may be more appropriate to send
a follow-up patch that cleans up all of net/socket.c.

Reviewed-by: Stefan Hajnoczi<address@hidden>

Stefan

I can do that. However is it really a leak considering the fact that
the program will call exit just after?
If it's a matter of consistency and coding style I would understand
though.

One more thing, git-format-patch added a "From" field to the header and
caused this glitch in the mail. I thought git-send-mail or the mail
server would handle it well but apparently not:

From 2f5b85fcadcfee3b75a6a21dc86d10b945c99f0f Mon Sep 17 00:00:00 2001
From: Benjamin MARSILI <address@hidden>

git-am didn't complain with the patch that I sent but it may break after
gmail relayed it (http://lists.gnu.org/archive/html/qemu-devel/2011-11/msg03152.html).
The second from header is interpreted as text... Should I remove the
first "From" field before sending the patch?

Sorry for the noise on the ML and thanks to all those who helped me get
involved.

Benjamin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]