From b509b608b5d22a06d618f011eaae0c4ab6c8e610 Mon Sep 17 00:00:00 2001 From: "Richard A. Kirian" Date: Tue, 29 Nov 2011 13:54:08 -0800 Subject: Fix possible seg fault in powder_plot --- libtool | 10 +++++----- src/powder_plot.c | 10 +++++++++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/libtool b/libtool index 10548d94..77dfc244 100755 --- a/libtool +++ b/libtool @@ -2,7 +2,7 @@ # libtool - Provide generalized library-building support services. # Generated automatically by config.status (crystfel) 0.2.0 -# Libtool was configured on host cfeld204tw.desy.de: +# Libtool was configured on host psexport01: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, @@ -93,7 +93,7 @@ NM="/usr/bin/nm -B" LN_S="ln -s" # What is the maximum length of a command? -max_cmd_len=1572864 +max_cmd_len=98304 # Object file suffix (normally "o"). objext=o @@ -237,10 +237,10 @@ finish_eval="" hardcode_into_libs=yes # Compile-time system search path for libraries. -sys_lib_search_path_spec="/usr/lib/gcc/x86_64-redhat-linux/4.5.1 /usr/lib64 /lib64 " +sys_lib_search_path_spec="/usr/lib/gcc/x86_64-redhat-linux/4.1.2 /usr/lib64 /lib64 " # Run-time system search path for libraries. -sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib /usr/lib64/atlas /usr/local/cuda/lib64 /usr/local/cuda/lib /usr/lib64/tcl8.5 /usr/lib64/xulrunner-1.9.2 " +sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib /usr/lib64/mysql /usr/lib/qt-3.3/lib /usr/lib64/qt-3.3/lib /usr/local/lib64 /usr/local/lib /usr/lib/xulrunner-1.9.2 /usr/lib64/xulrunner-1.9.2 " # Whether dlopen is supported. dlopen_support=unknown @@ -282,7 +282,7 @@ wl="-Wl," pic_flag=" -fPIC -DPIC" # Compiler flag to prevent dynamic linking. -link_static_flag="" +link_static_flag="-static" # Does compiler simultaneously support -c and -o options? compiler_c_o="yes" diff --git a/src/powder_plot.c b/src/powder_plot.c index d31ce59c..bb3ace9e 100644 --- a/src/powder_plot.c +++ b/src/powder_plot.c @@ -884,7 +884,15 @@ int main(int argc, char *argv[]) } - if ( is_stream(filename) ) { + + /* need to check that the file even exists before moving on */ + FILE * junk = fopen(filename,"r"); + if ( junk == NULL ) { + ERROR("The file %s does not exist!\n",filename); + exit(1); + } + + if ( is_stream(filename) == 1 ) { file_type = FILE_STREAM; fh = fopen(filename, "r"); -- cgit v1.2.3