changeset 8687:f3579c1d6be9

Fdrawnow: don't strip dirsep; return after errors
author John W. Eaton <jwe@octave.org>
date Thu, 05 Feb 2009 17:04:09 -0500
parents dd13355fc98a
children d7306ecd077a
files src/ChangeLog src/graphics.cc
diffstat 2 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Feb 05 13:46:47 2009 -0500
+++ b/src/ChangeLog	Thu Feb 05 17:04:09 2009 -0500
@@ -1,5 +1,8 @@
 2009-02-05  John W. Eaton  <jwe@octave.org>
 
+	* graphics.cc (Fdrawnow): Return after errors.  Don't strip
+	trailing directory separator from name used in call to file_stat.
+
 	* DLD-FUNCTIONS/eigs.cc (Feigs): Avoid warnings about ambiguous
 	else.  Style fixes.  Return after errors.
 
--- a/src/graphics.cc	Thu Feb 05 13:46:47 2009 -0500
+++ b/src/graphics.cc	Thu Feb 05 17:04:09 2009 -0500
@@ -4984,7 +4984,10 @@
 	      if (! error_state && val.compare ("expose"))
 		do_events = false;
 	      else
-		error ("drawnow: invalid argument, expected `expose' as argument");
+		{
+		  error ("drawnow: invalid argument, expected `expose' as argument");
+		  return retval;
+		}
 	    }
 
 	  if (do_events)
@@ -5013,11 +5016,17 @@
 
 		  if (pos != std::string::npos)
 		    {
-		      file_stat fs (file.substr (0, pos));
+		      std::string dirname = file.substr (0, pos+1);
+
+		      file_stat fs (dirname);
 
 		      if (! (fs && fs.is_dir ()))
-			error ("drawnow: nonexistent directory `%s'",
-			       file.substr (0, pos).c_str ());
+			{
+			  error ("drawnow: nonexistent directory `%s'",
+				 dirname.c_str ());
+
+			  return retval;
+			}
 		    }
 
 		  mono = (args.length () >= 3 ? args(2).bool_value () : false);