Hi there,

> commit 49684c0b43d79310429b314e484ac2b1ab4ac6a1
> Author: Christian Seiler <christ...@iwakd.de>
> Date:   Tue Nov 15 18:53:53 2011 +0100

Thanks a lot for applying this. Unfortunately, you did not include the
fixes for errno handling that came up later in the thread, where I
resent the patch. I've attached a patch against the current master
branch that takes care of this.

Christian
>From 56a822e6f035fe37a67e45d499419376de5d8711 Mon Sep 17 00:00:00 2001
From: Christian Seiler <christ...@iwakd.de>
Date: Fri, 6 Jan 2012 00:10:48 +0100
Subject: [PATCH] Fix errno handling in setup_private_host_hw_addr

The function did not return the correct errno in some cases.
---
 src/lxc/conf.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index 5e41d38..1a9851e 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -1406,6 +1406,7 @@ static int setup_private_host_hw_addr(char *veth1)
 {
 	struct ifreq ifr;
 	int err;
+	int saved_errno;
 	int sockfd;
 
 	sockfd = socket(AF_INET, SOCK_DGRAM, 0);
@@ -1415,15 +1416,17 @@ static int setup_private_host_hw_addr(char *veth1)
 	snprintf((char *)ifr.ifr_name, IFNAMSIZ, "%s", veth1);
 	err = ioctl(sockfd, SIOCGIFHWADDR, &ifr);
 	if (err < 0) {
+		saved_errno = errno;
 		close(sockfd);
-		return -errno;
+		return -saved_errno;
 	}
 
 	ifr.ifr_hwaddr.sa_data[0] = 0xfe;
 	err = ioctl(sockfd, SIOCSIFHWADDR, &ifr);
+	saved_errno = errno;
 	close(sockfd);
 	if (err < 0)
-		return -errno;
+		return -saved_errno;
 
 	DEBUG("mac address of host interface '%s' changed to private "
 	      "%02x:%02x:%02x:%02x:%02x:%02x", veth1,
-- 
1.7.2.5

------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to