[syslinux:pathbased] core: fs: verify call to fs_ops->readdir

syslinux-bot for Sebastian Herbszt herbszt at gmx.de
Thu Apr 1 16:09:02 PDT 2010


Commit-ID:  b50703d56b38fc5fa1ff21a0a01523083285d5c1
Gitweb:     http://syslinux.zytor.com/commit/b50703d56b38fc5fa1ff21a0a01523083285d5c1
Author:     Sebastian Herbszt <herbszt at gmx.de>
AuthorDate: Sun, 7 Mar 2010 16:02:50 +0100
Committer:  H. Peter Anvin <hpa at linux.intel.com>
CommitDate: Thu, 1 Apr 2010 16:04:27 -0700

core: fs: verify call to fs_ops->readdir

Check if fs_ops->readdir is available before calling it.
At least PXELINUX doesn't implement it.

Signed-off-by: Sebastian Herbszt <herbszt at gmx.de>
LKML-Reference: <1267974170$3058 at local>
Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>


---
 core/fs/readdir.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/core/fs/readdir.c b/core/fs/readdir.c
index d2b112b..d20fc33 100644
--- a/core/fs/readdir.c
+++ b/core/fs/readdir.c
@@ -28,8 +28,11 @@ struct dirent *readdir(DIR *dir)
     struct file *dd_dir = (struct file *)dir;
     int rv = -1;
     
-    if (dd_dir)
-	rv = dd_dir->fs->fs_ops->readdir(dd_dir, &buf);
+    if (dd_dir) {
+        if (dd_dir->fs->fs_ops->readdir) {
+	    rv = dd_dir->fs->fs_ops->readdir(dd_dir, &buf);
+        }
+    }
 
     return rv < 0 ? NULL : &buf;
 }



More information about the Syslinux-commits mailing list