Added mkdir error handling.
This commit is contained in:
8
main.c
8
main.c
@@ -222,7 +222,10 @@ int main(int argc, char *argv[])
|
|||||||
char *file_path = get_file(dir_path, t);
|
char *file_path = get_file(dir_path, t);
|
||||||
|
|
||||||
if(!is_directory(dir_path)) {
|
if(!is_directory(dir_path)) {
|
||||||
mkdir(dir_path, 0700); // WARNING: Might fail, what then?
|
if(mkdir(dir_path, 0700) == -1) {
|
||||||
|
fprintf(stderr, "mkdir(%s) failed: %s\n", dir_path, strerror(errno));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE *f;
|
FILE *f;
|
||||||
@@ -336,8 +339,7 @@ int main(int argc, char *argv[])
|
|||||||
current_activity = 0;
|
current_activity = 0;
|
||||||
|
|
||||||
activities[current_activity].type = type;
|
activities[current_activity].type = type;
|
||||||
activities[current_activity].color =
|
activities[current_activity].color = activity_type_color_representation[type];
|
||||||
activity_type_color_representation[type];
|
|
||||||
activities[current_activity].began = now();
|
activities[current_activity].began = now();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user