From bug-request at octave dot org Tue Jan 18 14:19:00 2005 Subject: Bug in mkstemp From: "John W. Eaton" To: Mats Jansson Cc: bug at octave dot org Date: Tue, 18 Jan 2005 15:22:07 -0500 On 18-Jan-2005, Mats Jansson wrote: | two things about the function 'mkstemp': | | 1) Error in doc-string: "tmpfile" should be changed to "mkstemp". | | 2) When mkstemp fails to create a temp-file, it returns the | error-message in the second output argument, not the third as said | in the documentation. Is this a documentation error or an error | in the code? Please try the following patch. Thanks, jwe src/ChangeLog: 2005-01-18 John W. Eaton * file-io.cc (Fmkstemp): Fix doc string. Error message belongs in third output value. From Mats Jansson . Index: src/file-io.cc =================================================================== RCS file: /usr/local/cvsroot/octave/src/file-io.cc,v retrieving revision 1.158.2.1 diff -u -r1.158.2.1 file-io.cc --- src/file-io.cc 3 Dec 2004 14:34:56 -0000 1.158.2.1 +++ src/file-io.cc 18 Jan 2005 20:15:47 -0000 at @ -1775,7 +1775,7 @@ DEFUN (mkstemp, args, , "-*- texinfo -*-\n\ - at deftypefn {Built-in Function} {[@var{fid}, @var{name}, @var{msg}] =} tmpfile (@var{template}, @var{delete})\n\ + at deftypefn {Built-in Function} {[@var{fid}, @var{name}, @var{msg}] =} mkstemp (@var{template}, @var{delete})\n\ Return the file ID corresponding to a new temporary file with a unique\n\ name created from at var{template} dot The last six characters of @var{template}\n\ must be at code{XXXXXX} and these are replaced with a string that makes the\n\ at @ -1819,7 +1819,7 @@ if (fd < 0) { using namespace std; - retval(1) = ::strerror (errno); + retval(2) = ::strerror (errno); retval(0) = fd; } else at @ -1850,7 +1850,7 @@ else { using namespace std; - retval(1) = ::strerror (errno); + retval(2) = ::strerror (errno); retval(0) = -1; } } ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------