changeset 10173:2b1f3f156aaf

provide wrapper for umask
author John W. Eaton <jwe@octave.org>
date Thu, 21 Jan 2010 02:25:53 -0500
parents 96ed9db3345c
children eb64bf1c6107
files liboctave/ChangeLog liboctave/file-ops.cc liboctave/lo-cutils.c liboctave/lo-utils.h
diffstat 4 files changed, 19 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog	Thu Jan 21 04:02:29 2010 -0500
+++ b/liboctave/ChangeLog	Thu Jan 21 02:25:53 2010 -0500
@@ -1,3 +1,9 @@
+2010-01-21  John W. Eaton  <jwe@octave.org>
+
+	* lo-cutils.c (octave_umask): New funtion.
+	* lo-utils.h: Provide decl.
+	* file-ops.cc (file_ops::umask): Call octave_umask.
+
 2010-01-21  John W. Eaton  <jwe@octave.org>
 
 	* file-ops.h (file_ops::mkdir): Move definitions to file-ops.cc.
--- a/liboctave/file-ops.cc	Thu Jan 21 04:02:29 2010 -0500
+++ b/liboctave/file-ops.cc	Thu Jan 21 02:25:53 2010 -0500
@@ -816,11 +816,7 @@
 int
 file_ops::umask (mode_t mode)
 {
-#if defined (HAVE_UMASK)
-  return ::umask (mode);
-#else
-  return 0;
-#endif
+  return octave_umask (mode);
 }
 
 int
--- a/liboctave/lo-cutils.c	Thu Jan 21 04:02:29 2010 -0500
+++ b/liboctave/lo-cutils.c	Thu Jan 21 02:25:53 2010 -0500
@@ -127,6 +127,16 @@
   return strncasecmp (s1, s2, n);
 }
 
+OCTAVE_API mode_t
+octave_umask (mode_t mode)
+{
+#if defined (HAVE_UMASK)
+  return umask (mode);
+#else
+  return 0;
+#endif
+}
+
 OCTAVE_API int
 octave_gethostname (char *name, int namelen)
 {
--- a/liboctave/lo-utils.h	Thu Jan 21 04:02:29 2010 -0500
+++ b/liboctave/lo-utils.h	Thu Jan 21 02:25:53 2010 -0500
@@ -69,6 +69,8 @@
 
 extern "C" OCTINTERP_API int octave_strncasecmp (const char *s1, const char *s2, size_t n);
 
+extern "C" OCTAVE_API mode_t octave_umask (mode_t);
+
 template <typename T>
 T
 octave_read_value (std::istream& is)