[segyio] 265/376: Print errmsg when mmap fails in segyinfo/inspect
Jørgen Kvalsvik
jokva-guest at moszumanska.debian.org
Wed Sep 20 08:04:42 UTC 2017
This is an automated email from the git hooks/post-receive script.
jokva-guest pushed a commit to branch debian
in repository segyio.
commit e27fbbd8503be750fbd5ae3e76ee279643b3c08c
Author: Jørgen Kvalsvik <jokva at statoil.com>
Date: Wed Mar 29 13:43:37 2017 +0200
Print errmsg when mmap fails in segyinfo/inspect
---
applications/segyinfo.c | 7 +++++--
applications/segyinspect.c | 10 +++++++++-
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/applications/segyinfo.c b/applications/segyinfo.c
index acf7b23..86faa91 100644
--- a/applications/segyinfo.c
+++ b/applications/segyinfo.c
@@ -36,8 +36,11 @@ int main(int argc, char* argv[]) {
exit( 3 );
}
- if( argc > 2 && strcmp( argv[ 2 ], "mmap" ) == 0 )
- segy_mmap( fp );
+ if( argc > 2 && strcmp( argv[ 2 ], "mmap" ) == 0 ) {
+ int err = segy_mmap( fp );
+ if( err != SEGY_OK )
+ fputs( "Could not mmap file. Using fstream fallback.", stderr );
+ }
int err;
char header[ SEGY_BINARY_HEADER_SIZE ];
diff --git a/applications/segyinspect.c b/applications/segyinspect.c
index 58615dc..f2ce366 100644
--- a/applications/segyinspect.c
+++ b/applications/segyinspect.c
@@ -38,6 +38,8 @@ static const char* getFastestDirectionName( int sorting ) {
int main(int argc, char* argv[]) {
+ int err;
+
if( argc < 2 ) {
puts("Missing argument, expected run signature:");
printf(" %s <segy_file> [mmap] [INLINE_BYTE CROSSLINE_BYTE]\n", argv[0]);
@@ -65,7 +67,13 @@ int main(int argc, char* argv[]) {
exit( SEGY_FOPEN_ERROR );
}
- int err;
+ if( memory_map ) {
+ err = segy_mmap( fp );
+ if( err != SEGY_OK )
+ fputs( "Could not mmap file. Using fstream fallback.", stderr );
+ }
+
+
char header[ SEGY_BINARY_HEADER_SIZE ];
err = segy_binheader( fp, header );
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/segyio.git
More information about the debian-science-commits
mailing list