aboutsummaryrefslogtreecommitdiff
path: root/booki.c
diff options
context:
space:
mode:
Diffstat (limited to 'booki.c')
-rw-r--r--booki.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/booki.c b/booki.c
index a1215ec..7f462eb 100644
--- a/booki.c
+++ b/booki.c
@@ -480,7 +480,9 @@ char** search(int argc, char* argv[], char* booki_file) {
return NULL;
}
- FILE *output = fopen(EDIT_FILE, "w");
+ FILE *output = NULL;
+ if (search_opts.edit)
+ output = fopen(EDIT_FILE, "w");
// book loop
struct Book books[MAX_BOOKS];
@@ -537,7 +539,8 @@ char** search(int argc, char* argv[], char* booki_file) {
}
free(data);
- fclose(output);
+ if (output)
+ fclose(output);
if (search_opts.edit)
open(EDIT_FILE);