diff liboctave/system/file-ops.cc @ 21910:4d723ba06b4a

provide wrappers for some unistd.h functions * liboctave/wrappers/unistd-wrappers.c, liboctave/wrappers/unistd-wrappers.h: New files. * liboctave/wrappers/module.mk: Update. * gl2ps-print.cc, oct-hist.cc, oct-procbuf.cc, oct-tex-lexer.in.ll, sysdep.cc, octave.cc, parse-tree/lex.ll, file-ops.cc, lo-sysdep.cc, oct-env.cc, oct-syscalls.cc, cmd-edit.cc, kpse.cc: Use wrappers instead of calling unistd.h functions directly.
author John W. Eaton <jwe@octave.org>
date Tue, 14 Jun 2016 18:10:04 -0400
parents d7cac41df82a
children aab79a1885cc
line wrap: on
line diff
--- a/liboctave/system/file-ops.cc	Tue Jun 14 16:31:34 2016 -0400
+++ b/liboctave/system/file-ops.cc	Tue Jun 14 18:10:04 2016 -0400
@@ -36,9 +36,6 @@
 #include <iostream>
 #include <vector>
 
-#include <sys/types.h>
-#include <unistd.h>
-
 #include "areadlink-wrapper.h"
 #include "canonicalize-file-name-wrapper.h"
 #include "dir-ops.h"
@@ -52,6 +49,7 @@
 #include "singleton-cleanup.h"
 #include "stat-wrappers.h"
 #include "str-vec.h"
+#include "unistd-wrappers.h"
 
 namespace octave
 {
@@ -456,7 +454,7 @@
 
       int status = -1;
 
-      status = gnulib::link (old_name.c_str (), new_name.c_str ());
+      status = octave_link_wrapper (old_name.c_str (), new_name.c_str ());
 
       if (status < 0)
         msg = gnulib::strerror (errno);
@@ -479,7 +477,7 @@
 
       int status = -1;
 
-      status = gnulib::symlink (old_name.c_str (), new_name.c_str ());
+      status = octave_symlink_wrapper (old_name.c_str (), new_name.c_str ());
 
       if (status < 0)
         msg = gnulib::strerror (errno);
@@ -551,7 +549,7 @@
 
       int status = -1;
 
-      status = gnulib::rmdir (name.c_str ());
+      status = octave_rmdir_wrapper (name.c_str ());
 
       if (status < 0)
         msg = gnulib::strerror (errno);
@@ -656,7 +654,7 @@
 
       int status = -1;
 
-      status = gnulib::unlink (name.c_str ());
+      status = octave_unlink_wrapper (name.c_str ());
 
       if (status < 0)
         msg = gnulib::strerror (errno);