Index: SysExec.cpp =================================================================== --- SysExec.cpp (Revision 6822) +++ SysExec.cpp (Arbeitskopie) @@ -17,9 +17,8 @@ NAMESPACE_UPP // replacement of tmpfile() -- has problems in windows -static FILE *TempFile(void) +static FILE *TempFile(const String& fName) { - String fName = GetTempFileName(); FILE *f = fopen(fName, "w+"); return f; } @@ -37,14 +36,16 @@ int saveStdout = dup(fileno(stdout)); // creates and opens a temporary file and assigns stdout to it - int OutFile = fileno(TempFile()); + String OutfName = GetTempFileName(); + int OutFile = fileno(TempFile(OutfName)); dup2(OutFile, 1); // saves stderr stream state int saveStderr = dup(fileno(stderr)); // creates and opens a temporary file and assigns stdout to it - int ErrFile = fileno(TempFile()); + String ErrfName = GetTempFileName(); + int ErrFile = fileno(TempFile(ErrfName)); dup2(ErrFile, 2); // builds the arguments and the environment @@ -123,9 +124,25 @@ } // closes files - close(OutFile); - close(ErrFile); + if(close(OutFile) < 0) { + Cerr() << "Error closing temporary file for stdout\n"; + } else { +#ifdef flagDELETE_TMP_FILES + DeleteFile(~OutfName); +#endif + } + if (close(ErrFile) < 0) { + Cerr() << "Error closing temporary file for stdout\n"; + } else { +#ifdef flagDELETE_TMP_FILES + DeleteFile(~ErrfName); +#endif + } + + free(argv); + free(envv); + return (!result); } // END SysExec()