From: smh Date: Fri, 14 May 2004 12:30:05 +0000 (+0000) Subject: PAL5847: comparing return value of system() function with -1 is very unreliable,... X-Git-Tag: Ecole_Ete_a6~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ba904b047b1aabfbcca3621e1db02511eb9c63d3;p=modules%2Fvisu.git PAL5847: comparing return value of system() function with -1 is very unreliable, for any non-zero value can be returned as error code. --- diff --git a/src/VISU_I/VISU_Gen_i.cc b/src/VISU_I/VISU_Gen_i.cc index 665fb4d5..33527f6d 100644 --- a/src/VISU_I/VISU_Gen_i.cc +++ b/src/VISU_I/VISU_Gen_i.cc @@ -231,11 +231,14 @@ namespace VISU{ QString aFileName = aPrefix + "_" + (pResult->GetName()).c_str(); static QString aCommand; aCommand.sprintf("cp %s %s%s",aFileInfo.filePath().latin1(),aTmpDir.ToCString(),aFileName.latin1()); - if(system(aCommand) == -1){ + + int aRes = system(aCommand); + if(aRes){ if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - Cann't execute the command :"<GetName()).c_str(); static QString aCommand; aCommand.sprintf("cp %s %s%s",aFileInfo.filePath().latin1(),aTmpDir.ToCString(),aFileName.latin1()); - - if(system(aCommand) == -1){ - if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - Cann't execute the command :"<