# HG changeset patch # User gthomas # Date 1043341646 0 # Node ID 47f3bb5e17442375338a5ad374933464ffc5862f # Parent 0bc0d1bd4fc2c56c92681148c118a0d5bfc32a94 Return error (instead of crashing) when trying to open and no file systems have been mounted. diff --git a/packages/io/fileio/current/ChangeLog b/packages/io/fileio/current/ChangeLog --- a/packages/io/fileio/current/ChangeLog +++ b/packages/io/fileio/current/ChangeLog @@ -1,3 +1,8 @@ +2003-01-23 Gary Thomas + + * 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 * src/fio.h: Added macros to deal with signal handling. These will diff --git a/packages/io/fileio/current/src/misc.cxx b/packages/io/fileio/current/src/misc.cxx --- 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++ )