Now makes sure that the index get_tty_index() returns is in a valid range.
Added some more conditional debug output, turned off debug output. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9154 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
#define MASTER_TRACE
|
//#define MASTER_TRACE
|
||||||
#ifdef MASTER_TRACE
|
#ifdef MASTER_TRACE
|
||||||
# define TRACE(x) dprintf x
|
# define TRACE(x) dprintf x
|
||||||
#else
|
#else
|
||||||
@@ -42,7 +42,10 @@ static status_t
|
|||||||
master_open(const char *name, uint32 flags, void **_cookie)
|
master_open(const char *name, uint32 flags, void **_cookie)
|
||||||
{
|
{
|
||||||
int32 index = get_tty_index(name);
|
int32 index = get_tty_index(name);
|
||||||
dprintf("TTY index = %ld (name = %s)\n", index, name);
|
if (index >= (int32)kNumTTYs)
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
|
TRACE(("master_open: TTY index = %ld (name = %s)\n", index, name));
|
||||||
|
|
||||||
if (atomic_or(&gMasterTTYs[index].open_count, 1) != 0) {
|
if (atomic_or(&gMasterTTYs[index].open_count, 1) != 0) {
|
||||||
// we're already open!
|
// we're already open!
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
#define SLAVE_TRACE
|
//#define SLAVE_TRACE
|
||||||
#ifdef SLAVE_TRACE
|
#ifdef SLAVE_TRACE
|
||||||
# define TRACE(x) dprintf x
|
# define TRACE(x) dprintf x
|
||||||
#else
|
#else
|
||||||
@@ -31,6 +31,10 @@ static status_t
|
|||||||
slave_open(const char *name, uint32 flags, void **_cookie)
|
slave_open(const char *name, uint32 flags, void **_cookie)
|
||||||
{
|
{
|
||||||
int32 index = get_tty_index(name);
|
int32 index = get_tty_index(name);
|
||||||
|
if (index >= (int32)kNumTTYs)
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
|
TRACE(("slave_open: TTY index = %ld (name = %s)\n", index, name));
|
||||||
|
|
||||||
// we may only be used if our master has already been opened
|
// we may only be used if our master has already been opened
|
||||||
if (gMasterTTYs[index].open_count == 0)
|
if (gMasterTTYs[index].open_count == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user