qphotorec: redirect stderr to the log file only if it exists

This commit is contained in:
Christophe Grenier 2013-06-04 08:43:43 +02:00
parent 79bf6ce3e1
commit ff449ff6f2

View file

@ -52,7 +52,10 @@ int main(int argc, char *argv[])
FILE *log_handle;
log_handle=log_open("qphotorec.log", TD_LOG_CREATE, &log_errno);
#ifdef HAVE_DUP2
dup2(fileno(log_handle),2);
if(log_handle)
{
dup2(fileno(log_handle),2);
}
#endif
my_time=time(NULL);
log_info("\n\n%s",ctime(&my_time));