From 9ac8389823ef97c57d4d74179afb9805d435f051 Mon Sep 17 00:00:00 2001 From: Frederic Culot Date: Sun, 1 Nov 2009 11:06:37 +0000 Subject: Check for data directory availability added (thanks Brandon for reporting this bug). --- src/io.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/io.c') diff --git a/src/io.c b/src/io.c index 059fc6d..1ef3c6f 100755 --- a/src/io.c +++ b/src/io.c @@ -1,4 +1,4 @@ -/* $calcurse: io.c,v 1.79 2009/10/28 15:15:44 culot Exp $ */ +/* $calcurse: io.c,v 1.80 2009/11/01 11:06:37 culot Exp $ */ /* * Calcurse - text-based organizer @@ -1498,8 +1498,8 @@ io_load_keys (char *pager) #undef HSIZE } -static void -check_directory (char *dir, int *missing) +void +io_check_dir (char *dir, int *missing) { errno = 0; if (mkdir (dir, 0700) != 0) @@ -1512,7 +1512,10 @@ check_directory (char *dir, int *missing) } } else - (*missing)++; + { + if (missing) + (*missing)++; + } } unsigned @@ -1570,8 +1573,8 @@ io_check_data_files (void) missing = missing_keys = 0; errno = 0; - check_directory (path_dir, &missing); - check_directory (path_notes, &missing); + io_check_dir (path_dir, &missing); + io_check_dir (path_notes, &missing); io_check_file (path_todo, &missing); io_check_file (path_apts, &missing); io_check_file (path_conf, &missing); -- cgit v1.2.3-54-g00ecf