]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
PAL5847: comparing return value of system() function with -1 is very unreliable,...
authorsmh <smh@opencascade.com>
Fri, 14 May 2004 12:30:05 +0000 (12:30 +0000)
committersmh <smh@opencascade.com>
Fri, 14 May 2004 12:30:05 +0000 (12:30 +0000)
src/VISU_I/VISU_Gen_i.cc

index 665fb4d5dc9487c9d38879168ec59736ca43767a..33527f6d89565c7a906701ac0af271cd427c040d 100644 (file)
@@ -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 :"<<aCommand);
            continue;
          }else
            if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - aCommand = "<<aCommand);
+
          TCollection_AsciiString aString(strdup(aFileName.latin1()));
          aFileNames.Append(aString);
        }
@@ -280,12 +283,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){
-           if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - Cann't execute the command :"<<aCommand);
+
+         int aRes = system(aCommand);
+         if(aRes){       
+           if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - Can't execute the command :"<<aCommand);
            continue;
          }else
            if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - "<<aCommand);
+
          TCollection_AsciiString aString(strdup(aFileName.latin1()));
          
          HDFascii::ConvertFromHDFToASCII(strdup((aTmpDir + aString).ToCString()), true);