Hi,
i have in one program such a pice of code
................
static int old_stderr_handle = -1;
static int old_stdout_handle = -1;
log_handle = open(log_file_name,O_CREAT|O_RDWR,932);
old_stderr_handle = dup(STDERR_FILENO);
if (dup2(log_handle,STDERR_FILENO) < 0)
{
// print error
}
old_stdout_handle = dup(STDOUT_FILENO);
if (dup2(log_handle,STDOUT_FILENO) < 0)
{
// print error
}
.....
close ( old_stderr_handle );
close ( old_stdout_handle);
I build this program with Insure ( a tool ) after this i run it and in the log file
i found a message like
(Thread 0) **USER_ERROR**
>> if (dup2(log_handle,STDERR_FILENO) < 0)
Attempt to implicitly close Insure++ internal file descriptor 2 in dup2() ignored
**Memory corrupted. Program may crash!!**
Can somebody explain why?
thanks.