changeset 534:47f3bb5e1744

Return error (instead of crashing) when trying to open and no file systems have been mounted.
author gthomas
date Thu, 23 Jan 2003 17:07:26 +0000
parents 0bc0d1bd4fc2
children 5b6aacdd7c0d
files packages/io/fileio/current/ChangeLog packages/io/fileio/current/src/misc.cxx
diffstat 2 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/packages/io/fileio/current/ChangeLog
+++ b/packages/io/fileio/current/ChangeLog
@@ -1,3 +1,8 @@
+2003-01-23  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/misc.cxx (cyg_mtab_lookup): Return an error if the current
+	directory is not known - happens if no file systems are mounted.
+
 2002-11-10  Nick Garnett  <nickg@ecoscentric.com>
 
 	* src/fio.h: Added macros to deal with signal handling. These will
--- a/packages/io/fileio/current/src/misc.cxx
+++ b/packages/io/fileio/current/src/misc.cxx
@@ -9,6 +9,7 @@
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2003 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
@@ -230,7 +231,14 @@ static int matchlen( const char *s1, con
     int best_len = 0;
 
     // Unrooted file names go straight to current dir
-    if( **name != '/' ) return 0;
+    if( **name != '/' ) {
+        if (*mte == (cyg_mtab_entry *)NULL) {
+            // No known current directory
+            return -1;
+        }
+        // Current directory is well known
+        return 0;
+    }
 
     // Otherwise search the mount table.
     for( m = &mtab[0]; m != &mtab_end; m++ )