# HG changeset patch # User jwe # Date 1143722930 0 # Node ID 8272a8f03b80f7fe4ef9731ec199a51a830d293a # Parent bd39bbda9bd9369755d8dcfdc3c01c69345a02d0 [project @ 2006-03-30 12:48:50 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2006-03-30 David Bateman + + * DLD-FUNCTIONS/fftw_wisdom.cc: Don't attempt to save wisdom to + an empty filename or invalid filename. + 2006-03-28 John W. Eaton * DLD-FUNCTIONS/matrix_type.cc: Update copyright notice and FSF diff --git a/src/DLD-FUNCTIONS/fftw_wisdom.cc b/src/DLD-FUNCTIONS/fftw_wisdom.cc --- a/src/DLD-FUNCTIONS/fftw_wisdom.cc +++ b/src/DLD-FUNCTIONS/fftw_wisdom.cc @@ -108,18 +108,28 @@ overwrite = true; } + std::string str = args(0).string_value (); std::string wisdom = octave_env::make_absolute - (Vload_path_dir_path.find_first_of (args(0).string_value ()), - octave_env::getcwd ()); + (Vload_path_dir_path.find_first_of (str), octave_env::getcwd ()); // XXX FIXME XXX -- should probably protect FILE* resources with // auto_ptr or similar... if (wisdom.empty () || overwrite) { - FILE *ofile = fopen (wisdom.c_str (), "wb"); - fftw_export_wisdom_to_file (ofile); - fclose (ofile); + if (str.empty ()) + error ("fftw_wisdom: can not save to file"); + else + { + FILE *ofile = fopen (str.c_str (), "wb"); + if (! ofile) + error ("fftw_wisdom: can not save to file %s", str.c_str()); + else + { + fftw_export_wisdom_to_file (ofile); + fclose (ofile); + } + } } else {