summaryrefslogtreecommitdiff
path: root/pfinet/main.c
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2015-11-03 22:44:07 +0100
committerJustus Winter <4winter@informatik.uni-hamburg.de>2015-11-03 22:46:17 +0100
commitd9a22b92a226419c50fd13013741679ce7e7b624 (patch)
treee779da84e9c151e2d5fb6f519d25b960af7f61ba /pfinet/main.c
parentff578e992a792e4a844a9a800e48ad9cef69e97a (diff)
pfinet: fix sanity check at translator startup time
* pfinet/main.c (main): Properly iterate over `pfinet_protid_portclasses'.
Diffstat (limited to 'pfinet/main.c')
-rw-r--r--pfinet/main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/pfinet/main.c b/pfinet/main.c
index 46457a90..4bfa3185 100644
--- a/pfinet/main.c
+++ b/pfinet/main.c
@@ -269,6 +269,8 @@ extern void sk_init (void), skb_init (void);
extern int net_dev_init (void);
extern void inet6_proto_init (struct net_proto *pro);
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
int
main (int argc,
char **argv)
@@ -374,11 +376,11 @@ main (int argc,
int i;
/* Check that at least one portclass has been bound,
error out otherwise. */
- for (i = 0; i < trivfs_protid_nportclasses; i ++)
+ for (i = 0; i < ARRAY_SIZE (pfinet_protid_portclasses); i++)
if (pfinet_protid_portclasses[i] != MACH_PORT_NULL)
break;
- if (i == trivfs_protid_nportclasses)
+ if (i == ARRAY_SIZE (pfinet_protid_portclasses))
error (1, 0, "should be started as a translator.\n");
}