summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libc/telldir.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1999-11-02 16:25:05 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1999-11-02 16:25:05 +0000
commit19b74f3175705f923fed1c83a13a3a731c5e0de7 (patch)
tree859e11851cac98cd932d55888103030b923666ed /c/src/lib/libc/telldir.c
parentFixed typo where memfile_handlers set twice and directory_handlers (diff)
downloadrtems-19b74f3175705f923fed1c83a13a3a731c5e0de7.tar.bz2
Check for NULL being passed in.
Diffstat (limited to '')
-rw-r--r--c/src/lib/libc/telldir.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/c/src/lib/libc/telldir.c b/c/src/lib/libc/telldir.c
index cea6cc08cb..765bb4ed44 100644
--- a/c/src/lib/libc/telldir.c
+++ b/c/src/lib/libc/telldir.c
@@ -16,6 +16,7 @@
#include <dirent.h>
#include <stdlib.h>
#include <unistd.h>
+#include <errno.h>
#include "libio_.h"
@@ -26,8 +27,12 @@ long telldir(
{
rtems_libio_t *iop;
+ if ( !dirp )
+ set_errno_and_return_minus_one( EBADF );
+
/*
- * Get the file control block structure associated with the file descriptor
+ * Get the file control block structure associated with the
+ * file descriptor
*/
iop = rtems_libio_iop( dirp->dd_fd );