summaryrefslogtreecommitdiffstats
path: root/src/qmainrec.cpp
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-06-04 08:43:43 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2013-06-04 08:43:43 +0200
commitff449ff6f27142fcc70b1c2d32641504f9b6f768 (patch)
tree9ef78efe26ac8d97922ad69d1a877fa398631f5f /src/qmainrec.cpp
parent79bf6ce3e167f07b1c789e53d586054ecfb04156 (diff)
qphotorec: redirect stderr to the log file only if it exists
Diffstat (limited to 'src/qmainrec.cpp')
-rw-r--r--src/qmainrec.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/qmainrec.cpp b/src/qmainrec.cpp
index fe41de8..67fbb54 100644
--- a/src/qmainrec.cpp
+++ b/src/qmainrec.cpp
@@ -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));