aboutsummaryrefslogtreecommitdiff
path: root/dist/check_fopen_error.patch
blob: 8adec59f52e9c98614afa04ebfd5ba797563e83e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
diff -ru Lorene/Export/C++/Source/bin_bh_aux.C Lorene/Export/C++/Source/bin_bh_aux.C
--- Lorene/Export/C++/Source/bin_bh_aux.C	2009-09-21 17:01:18.000000000 -0700
+++ Lorene/Export/C++/Source/bin_bh_aux.C	2012-01-25 11:41:48.000000000 -0800
@@ -62,8 +62,14 @@
 #include "../Include/bin_bh.h"
 
 // C headers
+#include <string.h>
+#include <errno.h>
 #include <math.h>
 
+// C++ headers
+#include <ios>
+#include <string>
+
 // Lorene headers
 #include "tenseur.h"
 #include "bhole.h"
@@ -82,6 +88,9 @@
     // Reading of data
     // ---------------
     FILE* fich = fopen(filename, "r") ;
+    if ( NULL == fich ) {
+	throw std::ios_base::failure(strerror(errno));
+    }
     Mg3d* grille_1 = new Mg3d (fich) ;
     Mg3d* grille_2 ;
     if (mdiff)
diff -ru Lorene/Export/C++/Source/bin_ns_aux.C Lorene/Export/C++/Source/bin_ns_aux.C
--- Lorene/Export/C++/Source/bin_ns_aux.C	2006-09-12 01:04:07.000000000 -0700
+++ Lorene/Export/C++/Source/bin_ns_aux.C	2012-01-25 11:39:08.000000000 -0800
@@ -56,8 +56,13 @@
 
 // C headers
 #include <string.h>
+#include <errno.h>
 #include <math.h>
 
+// C++ headers
+#include <ios>
+#include <string>
+
 // Lorene headers
 #include "tenseur.h"
 #include "binaire.h"
@@ -77,6 +82,9 @@
     // Reading of data
     // ---------------
     FILE* fich = fopen(filename, "r") ;
+    if ( NULL == fich ) {
+	throw std::ios_base::failure(strerror(errno));
+    }
 
     int mer ;
     fread(&mer, sizeof(int), 1, fich) ; // mer
diff -ru Lorene/Export/C++/Source/mag_ns_aux.C Lorene/Export/C++/Source/mag_ns_aux.C
--- Lorene/Export/C++/Source/mag_ns_aux.C	2009-11-19 08:15:21.000000000 -0800
+++ Lorene/Export/C++/Source/mag_ns_aux.C	2012-01-25 11:41:59.000000000 -0800
@@ -43,8 +43,13 @@
 
 // C headers
 #include <string.h>
+#include <errno.h>
 #include <math.h>
 
+// C++ headers
+#include <ios>
+#include <string>
+
 // Lorene headers
 #include "tenseur.h"
 #include "et_rot_mag.h"
@@ -67,6 +72,9 @@
     // Reading of data
     // ---------------
     FILE* fich = fopen(filename, "r") ;
+    if ( NULL == fich ) {
+	throw std::ios_base::failure(strerror(errno));
+    }
 
     Mg3d spectral_grid(fich) ;
     int nphi = spectral_grid.get_np(0) ;