From d87566f3883e1b85a866eb5dff8c99caa6ca2142 Mon Sep 17 00:00:00 2001
From: Mathieu Faverge <mathieu.faverge@inria.fr>
Date: Tue, 8 Aug 2017 15:10:06 +0200
Subject: [PATCH] Keep removing PASTIX_FOPEN

---
 spm_io.c          | 15 +++++++++++++--
 spm_read_driver.c |  6 +++++-
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/spm_io.c b/spm_io.c
index 946cd6f1..50d808c1 100644
--- a/spm_io.c
+++ b/spm_io.c
@@ -470,7 +470,13 @@ spmLoad( pastix_spm_t  *spm,
     int local_stream = 0;
 
     if ( infile == NULL ) {
-        PASTIX_FOPEN( infile, "matrix.spm", "r" );
+        infile = fopen( "matrix.spm", "r" );
+
+        if ( infile == NULL ) {
+            pastix_error_print( "spmLoad: Impossible to open the file matrix.spm\n");
+            return PASTIX_ERR_FILE;
+        }
+
         local_stream = 1;
     }
 
@@ -808,7 +814,12 @@ spmSave( const pastix_spm_t *spm,
     int local_stream = 0;
 
     if ( outfile == NULL ) {
-        PASTIX_FOPEN( outfile, "matrix.spm", "w" );
+        outfile = fopen( "matrix.spm", "w" );
+        if ( outfile == NULL ) {
+            pastix_error_print( "spmSave: Impossible to open the file matrix.spm\n");
+            return PASTIX_ERR_FILE;
+        }
+
         local_stream = 1;
     }
 
diff --git a/spm_read_driver.c b/spm_read_driver.c
index c8543481..6ca1cb6d 100644
--- a/spm_read_driver.c
+++ b/spm_read_driver.c
@@ -113,7 +113,11 @@ spmReadDriver( pastix_driver_t  driver,
             SCOTCH_Graph sgraph;
             FILE *file;
 
-            PASTIX_FOPEN( file, filename, "r" );
+            file = fopen( filename, "r" );
+            if ( file == NULL ) {
+                pastix_error_print("spmReadDriver: impossible to open the file %s\n", filename );
+                return PASTIX_ERR_FILE;
+            }
 
             /* Check integer compatibility */
             if (sizeof(pastix_int_t) != sizeof(SCOTCH_Num)) {
-- 
GitLab