7022269: clean up fscanf usage in Linux networking native code
Reviewed-by: michaelm, alanb
This commit is contained in:
parent
cea2f39843
commit
b989a55847
@ -1099,7 +1099,7 @@ static netif *enumIPv4Interfaces(JNIEnv *env, int sock, netif *ifs) {
|
|||||||
#ifdef AF_INET6
|
#ifdef AF_INET6
|
||||||
static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) {
|
static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) {
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char addr6[40], devname[20];
|
char addr6[40], devname[21];
|
||||||
char addr6p[8][5];
|
char addr6p[8][5];
|
||||||
int plen, scope, dad_status, if_idx;
|
int plen, scope, dad_status, if_idx;
|
||||||
uint8_t ipv6addr[16];
|
uint8_t ipv6addr[16];
|
||||||
|
@ -608,7 +608,7 @@ static void initLoopbackRoutes() {
|
|||||||
{
|
{
|
||||||
/* now find the scope_id for "lo" */
|
/* now find the scope_id for "lo" */
|
||||||
|
|
||||||
char devname[20];
|
char devname[21];
|
||||||
char addr6p[8][5];
|
char addr6p[8][5];
|
||||||
int plen, scope, dad_status, if_idx;
|
int plen, scope, dad_status, if_idx;
|
||||||
|
|
||||||
@ -651,7 +651,7 @@ static int nifs = 0; /* number of entries used in array */
|
|||||||
static void initLocalIfs () {
|
static void initLocalIfs () {
|
||||||
FILE *f;
|
FILE *f;
|
||||||
unsigned char staddr [16];
|
unsigned char staddr [16];
|
||||||
char ifname [32];
|
char ifname [33];
|
||||||
struct localinterface *lif=0;
|
struct localinterface *lif=0;
|
||||||
int index, x1, x2, x3;
|
int index, x1, x2, x3;
|
||||||
unsigned int u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,ua,ub,uc,ud,ue,uf;
|
unsigned int u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,ua,ub,uc,ud,ue,uf;
|
||||||
@ -660,7 +660,7 @@ static void initLocalIfs () {
|
|||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
while (fscanf (f, "%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x "
|
while (fscanf (f, "%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x "
|
||||||
"%d %x %x %x %s",&u0,&u1,&u2,&u3,&u4,&u5,&u6,&u7,
|
"%d %x %x %x %32s",&u0,&u1,&u2,&u3,&u4,&u5,&u6,&u7,
|
||||||
&u8,&u9,&ua,&ub,&uc,&ud,&ue,&uf,
|
&u8,&u9,&ua,&ub,&uc,&ud,&ue,&uf,
|
||||||
&index, &x1, &x2, &x3, ifname) == 21) {
|
&index, &x1, &x2, &x3, ifname) == 21) {
|
||||||
staddr[0] = (unsigned char)u0;
|
staddr[0] = (unsigned char)u0;
|
||||||
@ -1102,7 +1102,7 @@ int getDefaultIPv6Interface(struct in6_addr *target_addr) {
|
|||||||
* index.
|
* index.
|
||||||
*/
|
*/
|
||||||
if (match) {
|
if (match) {
|
||||||
char devname[20];
|
char devname[21];
|
||||||
char addr6p[8][5];
|
char addr6p[8][5];
|
||||||
int plen, scope, dad_status, if_idx;
|
int plen, scope, dad_status, if_idx;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user