summaryrefslogtreecommitdiffstats
path: root/src/phmain.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-04-27 18:12:23 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2013-04-27 18:12:23 +0200
commita3d8937a1918db7ac21968f0729c54f582eec711 (patch)
tree970b2079bc9ca1bcfbd73c2f8d412b51fcc40e92 /src/phmain.c
parentb40eee6a327a9474d4986cf723f236a8b556a60d (diff)
Use the correct value of errno to display a warning when log file creation failed
Diffstat (limited to 'src/phmain.c')
-rw-r--r--src/phmain.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/phmain.c b/src/phmain.c
index 7ed8829..964298f 100644
--- a/src/phmain.c
+++ b/src/phmain.c
@@ -109,6 +109,7 @@ int main( int argc, char **argv )
list_disk_t *element_disk;
const char *logfile="photorec.log";
FILE *log_handle=NULL;
+ int log_errno=0;
struct ph_options options={
.paranoid=1,
.keep_corrupted_file=0,
@@ -253,7 +254,7 @@ int main( int argc, char **argv )
xml_set_command_line(argc, argv);
#endif
if(create_log!=TD_LOG_NONE)
- log_handle=log_open(logfile, create_log);
+ log_handle=log_open(logfile, create_log, &log_errno);
#ifdef HAVE_SETLOCALE
if(run_setlocale>0)
{
@@ -268,7 +269,7 @@ int main( int argc, char **argv )
}
#endif
if(create_log!=TD_LOG_NONE && log_handle==NULL)
- log_handle=log_open_default(logfile, create_log);
+ log_handle=log_open_default(logfile, create_log, &log_errno);
#ifdef HAVE_NCURSES
/* ncurses need locale for correct unicode support */
if(start_ncurses("PhotoRec", argv[0]))
@@ -280,9 +281,9 @@ int main( int argc, char **argv )
const char*filename=logfile;
while(create_log!=TD_LOG_NONE && log_handle==NULL)
{
- filename=ask_log_location(filename);
+ filename=ask_log_location(filename, log_errno);
if(filename!=NULL)
- log_handle=log_open(filename, create_log);
+ log_handle=log_open(filename, create_log, &log_errno);
else
create_log=TD_LOG_NONE;
}