rem: dprintf("TTY index = %ld (name = %s)\n", index, name);
add: if (index >= (int32)kNumTTYs) return B_ERROR;  TRACE(("master_open: TTY index = %ld (name = %s)\n", index, name));
context: master_open(const char *name, uint32 flags, void **_cookie){	int32 index = get_tty_index(name);	dprintf("TTY index = %ld (name = %s)\n", index, name);	if (atomic_or(&gMasterTTYs[index].open_count, 1) != 0) {		// we're already open!		return B_BUSY;	}	status_t status = tty_open(&gMasterTTYs[index], &master_service);	if (status < B_OK) {		// initializing TTY failed, reset open counter		atomic_and(&gMasterTTYs[index].open_count, 0);		return status;	}	master_cookie *cookie = (master_cookie *)malloc(sizeof(struct master_cookie));	if (cookie == NULL) {		atomic_and(&gMasterTTYs[index].open_count, 0);		tty_close(&gMasterTTYs[index]);		return B_NO_MEMORY;	}	cookie->tty = &gMasterTTYs[index];	cookie->slave = &gSlaveTTYs[index];	cookie->open_mode = flags;	*_cookie = cookie;	return B_OK;}