X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fvserver-start%2Finterface.c;h=c3f3bb34c8b75ff29bce3215144e6ac8bfb5193b;hb=41815c3a043fd94adcbf54e52ee891a3e44313fa;hp=6afbbe4826cced72b6147adaea6669e1aa7e2be4;hpb=e3be43e3ee2157a63ea175463629c2433f595854;p=util-vserver.git diff --git a/util-vserver/vserver-start/interface.c b/util-vserver/vserver-start/interface.c index 6afbbe4..c3f3bb3 100644 --- a/util-vserver/vserver-start/interface.c +++ b/util-vserver/vserver-start/interface.c @@ -24,16 +24,31 @@ #include "vserver-start.h" #include "configuration.h" +#include "undo.h" #include +static void +Iface_removeWrapper(void const *iface) +{ + (void)Iface_remove(iface); +} + void -activateInterfaces() +activateInterfaces(InterfaceList const *interfaces) { struct Interface const * iface; - for (iface=Vector_begin(&cfg.interfaces); - iface!=Vector_end(&cfg.interfaces); - ++iface) - Iface_add(iface); + for (iface=Vector_begin_const(interfaces); + iface!=Vector_end_const(interfaces); + ++iface) { + if (!Iface_add(iface)) { + WRITE_MSG(2, "Failed to add interface "); + Iface_print(iface, 2); + WRITE_MSG(2, "\n"); + + exit(1); + } + Undo_addTask(Iface_removeWrapper, iface); + } }