This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FileIO - better error handling on open


Index: io/fileio/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/io/fileio/current/ChangeLog,v
retrieving revision 1.24
diff -u -5 -p -r1.24 ChangeLog
--- io/fileio/current/ChangeLog	11 Nov 2002 23:58:53 -0000	1.24
+++ io/fileio/current/ChangeLog	23 Jan 2003 17:06:49 -0000
@@ -1,5 +1,10 @@
+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
 	call into the POSIX package if it is present, but are null if it
 	is not.
Index: io/fileio/current/src/misc.cxx
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/io/fileio/current/src/misc.cxx,v
retrieving revision 1.6
diff -u -5 -p -r1.6 misc.cxx
--- io/fileio/current/src/misc.cxx	23 May 2002 23:06:09 -0000	1.6
+++ io/fileio/current/src/misc.cxx	23 Jan 2003 14:24:11 -0000
@@ -7,10 +7,11 @@
 //==========================================================================
 //####ECOSGPLCOPYRIGHTBEGIN####
 // -------------------------------------------
 // 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
 // Software Foundation; either version 2 or (at your option) any later version.
 //
@@ -228,11 +229,18 @@ __externC int cyg_mtab_lookup( cyg_dir *
 {
     cyg_mtab_entry *m, *best = NULL;
     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++ )
     {
         if( m->name != NULL && m->valid )


-- 
------------------------------------------------------------
Gary Thomas                 |
MLB Associates              |  Consulting for the
+1 (970) 229-1963           |    Embedded world
http://www.mlbassoc.com/    |
email: <gary@mlbassoc.com>  |
gpg: http://www.chez-thomas.org/gary/gpg_key.asc
------------------------------------------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]