Module Name: src Committed By: plunky Date: Tue Apr 20 21:25:25 UTC 2010
Modified Files: src/sbin/ifconfig: parse.c Log Message: C99 says that offsetof() expands to a constant expresssion, so we can't use variable array index in there. Do the calculation manually for C99 compilers (pcc) To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sbin/ifconfig/parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sbin/ifconfig/parse.c diff -u src/sbin/ifconfig/parse.c:1.14 src/sbin/ifconfig/parse.c:1.15 --- src/sbin/ifconfig/parse.c:1.14 Tue Jul 28 18:21:06 2009 +++ src/sbin/ifconfig/parse.c Tue Apr 20 21:25:25 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.14 2009/07/28 18:21:06 dyoung Exp $ */ +/* $NetBSD: parse.c,v 1.15 2010/04/20 21:25:25 plunky Exp $ */ /*- * Copyright (c) 2008 David Young. All rights reserved. @@ -27,7 +27,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: parse.c,v 1.14 2009/07/28 18:21:06 dyoung Exp $"); +__RCSID("$NetBSD: parse.c,v 1.15 2010/04/20 21:25:25 plunky Exp $"); #endif /* not lint */ #include <err.h> @@ -252,8 +252,8 @@ return -1; dbg_warnx("%s.%d", __func__, __LINE__); sdl->sdl_data[i++] = octet; - sdl->sdl_len = - offsetof(struct sockaddr_dl, sdl_data[i]); + sdl->sdl_len = offsetof(struct sockaddr_dl, sdl_data) + + i * sizeof(sdl->sdl_data[0]); sdl->sdl_alen = i; return 0; }