diff options
| author | marcinzelent <marcin@zelent.net> | 2017-06-22 10:43:51 +0200 |
|---|---|---|
| committer | marcinzelent <marcin@zelent.net> | 2017-06-22 10:43:51 +0200 |
| commit | 47bd4b045b6bfaf8ea21a8bafcd2f2acd4e338c7 (patch) | |
| tree | 0f2f8e7546cd6ad4b59f3fae7e1cc7312a9db0e6 | |
| parent | c1b00b215ae91638de367bf43cab9aaeac0f4e04 (diff) | |
Fixed bug causing segmentation fault when there was no timesheets
directory or file.
| -rw-r--r-- | timetracker.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/timetracker.c b/timetracker.c index 3aaa40f..ab7a56b 100644 --- a/timetracker.c +++ b/timetracker.c @@ -3,6 +3,9 @@ #include <time.h> #include <string.h> #include <curses.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> void print_new_activity(); void start_new_activity(); @@ -120,7 +123,6 @@ void stop_new_activity() break; } } - } void edit_new_activity() @@ -134,16 +136,13 @@ void save_to_file() { FILE *fp; time_t rawtime; - struct tm *info; - char buffer[80]; - - time(&rawtime); + struct tm *info; + char buffer[ |