]> Zhao Yanbai Git Server - minix.git/commitdiff
t40c term[] count fix 22/322/2
authorBen Gras <ben@minix3.org>
Sat, 9 Feb 2013 17:42:33 +0000 (18:42 +0100)
committerBen Gras <ben@minix3.org>
Sat, 9 Feb 2013 17:51:56 +0000 (18:51 +0100)
. term[] did not have the promised number of entries

Change-Id: I06a45ca0d948a6876bf1bffd0ec4706c88b7a3b0

test/t40c.c

index 1302265d1088f994eed347b643c6df7fb2f214e2..c816b2647006d1cf7522a339bde7a6a374948859 100644 (file)
@@ -42,10 +42,11 @@ void open_terminal(int *child_fd, int *parent_fd) {
   char opentermw[5+OPEN_MAX+1];
   char opentermr[5+OPEN_MAX+1];
   char *term[] = {"f","e","d","c","b","a","9","8","7","6","5","4","3","2","1"};
+#define TERMS (sizeof(term)/sizeof(term[0]))
 
   if (!child_fd || !parent_fd) exit(EXIT_FAILURE);
 
-  for (i = 0; i < 16; i++) {
+  for (i = 0; i < TERMS; i++) {
        snprintf(opentermw, 5+OPEN_MAX, "/dev/ttyp%s", term[i]);
        snprintf(opentermr, 5+OPEN_MAX, "/dev/ptyp%s", term[i]);