2001-04-20 Joel Sherrill <joel@OARcorp.com>

* devnull/devnull.c (null_initialize): Added check to
	ensure that the driver is only initialized once.  Otherwise,
	it will abort when the device /dev/null is present.
	(null_write): Do not dereference a NULL pointer.
This commit is contained in:
Joel Sherrill
2001-04-20 13:37:05 +00:00
parent 5346276237
commit a5bdcd9881
4 changed files with 46 additions and 20 deletions

View File

@@ -1,3 +1,10 @@
2001-04-20 Joel Sherrill <joel@OARcorp.com>
* devnull/devnull.c (null_initialize): Added check to
ensure that the driver is only initialized once. Otherwise,
it will abort when the device /dev/null is present.
(null_write): Do not dereference a NULL pointer.
2001-02-06 Ralf Corsepius <corsepiu@faw.uni-ulm.de> 2001-02-06 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* monitor/mon-command.c: Use #if defined(RTEMS_UNIX). * monitor/mon-command.c: Use #if defined(RTEMS_UNIX).

View File

@@ -32,6 +32,7 @@
*/ */
rtems_unsigned32 NULL_major; rtems_unsigned32 NULL_major;
static initialized;
rtems_device_driver null_initialize( rtems_device_driver null_initialize(
rtems_device_major_number major, rtems_device_major_number major,
@@ -39,18 +40,22 @@ rtems_device_driver null_initialize(
void *pargp void *pargp
) )
{ {
rtems_device_driver status ; rtems_device_driver status;
status = rtems_io_register_name( if ( !initialized ) {
"/dev/null", initialized = 1;
major,
(rtems_device_minor_number) 0 status = rtems_io_register_name(
"/dev/null",
major,
(rtems_device_minor_number) 0
); );
if (status != RTEMS_SUCCESSFUL) if (status != RTEMS_SUCCESSFUL)
rtems_fatal_error_occurred(status); rtems_fatal_error_occurred(status);
NULL_major = major; NULL_major = major;
}
return RTEMS_SUCCESSFUL; return RTEMS_SUCCESSFUL;
} }
@@ -143,9 +148,10 @@ rtems_device_driver null_write(
void *pargp void *pargp
) )
{ {
rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *) pargp ; rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *) pargp;
rw_args->bytes_moved = rw_args->count ; if ( rw_args )
rw_args->bytes_moved = rw_args->count;
return NULL_SUCCESSFUL; return NULL_SUCCESSFUL;
} }

View File

@@ -1,3 +1,10 @@
2001-04-20 Joel Sherrill <joel@OARcorp.com>
* devnull/devnull.c (null_initialize): Added check to
ensure that the driver is only initialized once. Otherwise,
it will abort when the device /dev/null is present.
(null_write): Do not dereference a NULL pointer.
2001-02-06 Ralf Corsepius <corsepiu@faw.uni-ulm.de> 2001-02-06 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* monitor/mon-command.c: Use #if defined(RTEMS_UNIX). * monitor/mon-command.c: Use #if defined(RTEMS_UNIX).

View File

@@ -32,6 +32,7 @@
*/ */
rtems_unsigned32 NULL_major; rtems_unsigned32 NULL_major;
static initialized;
rtems_device_driver null_initialize( rtems_device_driver null_initialize(
rtems_device_major_number major, rtems_device_major_number major,
@@ -39,18 +40,22 @@ rtems_device_driver null_initialize(
void *pargp void *pargp
) )
{ {
rtems_device_driver status ; rtems_device_driver status;
status = rtems_io_register_name( if ( !initialized ) {
"/dev/null", initialized = 1;
major,
(rtems_device_minor_number) 0 status = rtems_io_register_name(
"/dev/null",
major,
(rtems_device_minor_number) 0
); );
if (status != RTEMS_SUCCESSFUL) if (status != RTEMS_SUCCESSFUL)
rtems_fatal_error_occurred(status); rtems_fatal_error_occurred(status);
NULL_major = major; NULL_major = major;
}
return RTEMS_SUCCESSFUL; return RTEMS_SUCCESSFUL;
} }
@@ -143,9 +148,10 @@ rtems_device_driver null_write(
void *pargp void *pargp
) )
{ {
rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *) pargp ; rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *) pargp;
rw_args->bytes_moved = rw_args->count ; if ( rw_args )
rw_args->bytes_moved = rw_args->count;
return NULL_SUCCESSFUL; return NULL_SUCCESSFUL;
} }