From d9730c32c13e6e0bbbbb5888e9f11b0d09a7211d Mon Sep 17 00:00:00 2001 From: Philippe Canal <pcanal@fnal.gov> Date: Sat, 4 Sep 2010 15:59:29 +0000 Subject: [PATCH] Fix implementation of -G option (coverity) git-svn-id: http://root.cern.ch/svn/root/trunk@35141 27541ba8-7e3a-0410-8455-c3a389f83636 --- cint/cint/src/init.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cint/cint/src/init.cxx b/cint/cint/src/init.cxx index b688f6df1d0..b03d2dccd08 100644 --- a/cint/cint/src/init.cxx +++ b/cint/cint/src/init.cxx @@ -1017,8 +1017,15 @@ int G__main(int argc, char** argv) G__debugtrace = G__istrace = G__debug = 1; G__setdebugcond(); break; - case 'G': /* trace dump */ - G__serr = fopen(optarg, "w"); + case 'G': { /* trace dump */ + FILE *newerr = fopen(optarg, "w"); + if (newerr==0) { + G__fprinterr(G__serr, " -G : unable to open file %s.\n",optarg); + } else { + G__serr = newerr; + } + break; + } case 't': /* trace of input file */ /* sprintf(monitorfile,"%s",optarg); */ G__fprinterr(G__serr, " -t : trace execution\n"); -- GitLab