From: Ben Gras Date: Sat, 9 Feb 2013 17:42:33 +0000 (+0100) Subject: t40c term[] count fix X-Git-Tag: v3.2.1~18 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=refs%2Fchanges%2F22%2F322%2F2;p=minix.git t40c term[] count fix . term[] did not have the promised number of entries Change-Id: I06a45ca0d948a6876bf1bffd0ec4706c88b7a3b0 --- diff --git a/test/t40c.c b/test/t40c.c index 1302265d1..c816b2647 100644 --- a/test/t40c.c +++ b/test/t40c.c @@ -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]);