Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Gentoo Development (http://www.linux-archive.org/gentoo-development/)
-   -   ipoib support - write TYPE to ifcfg also for disabled devices (#660686) (http://www.linux-archive.org/gentoo-development/639480-ipoib-support-write-type-ifcfg-also-disabled-devices-660686-a.html)

David Cantrell 03-01-2012 05:43 PM

ipoib support - write TYPE to ifcfg also for disabled devices (#660686)
 
Ack, with one comment. I'd prefer the if() statements on a line by
themselves and the fprintf() indented below it.

On Thu, Mar 01, 2012 at 06:08:42PM +0100, Radek Vykydal wrote:
> Related: rhbz#660686
> ---
> loader/net.c | 9 ++++++---
> 1 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/loader/net.c b/loader/net.c
> index 0b0d16d..b4add2b 100644
> --- a/loader/net.c
> +++ b/loader/net.c
> @@ -161,10 +161,10 @@ static void ipCallback(newtComponent co, void * dptr) {
> *
> * This can directly be written into the ifcfg script's TYPE= field.
> */
> -static char *netArpTypeStr(iface_t *iface)
> +static char *netArpTypeStr(const char *ifname)
> {
> char *ret = NULL;
> - int arptype = iface_get_arptype(iface->device);
> + int arptype = iface_get_arptype(ifname);
> switch (arptype) {
> case ARPHRD_ETHER:
> ret = strdup("Ethernet");
> @@ -1236,6 +1236,9 @@ int writeDisabledIfcfgFile(char *device) {
>
> fprintf(fp, "DEVICE=%s
", device);
> fprintf(fp, "HWADDR=%s
", iface_mac2str(device));
> + char *str_type = netArpTypeStr(device);
> + if (str_type) fprintf(fp, "TYPE=%s
", str_type);
> + free(str_type);
> uuid = nm_utils_uuid_generate();
> fprintf(fp, "UUID=%s
", uuid);
> g_free(uuid);
> @@ -1346,7 +1349,7 @@ int writeEnabledNetInfo(iface_t *iface) {
> fprintf(fp, "UUID=%s
", uuid);
> g_free(uuid);
> fprintf(fp, "ONBOOT=yes
");
> - char *str_type = netArpTypeStr(iface);
> + char *str_type = netArpTypeStr(iface->device);
> if (str_type) fprintf(fp, "TYPE=%s
", str_type);
> free(str_type);

--
David Cantrell <dcantrell@redhat.com>
Supervisor, Installer Engineering Team
Red Hat, Inc. | Westford, MA | EST5EDT

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 10:07 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.