Fix missing EOL in imported note

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
Lars Henriksen 2020-03-27 08:23:07 +01:00 committed by Lukas Fleischer
parent e535eff904
commit 41ac4bd96f

View File

@ -59,9 +59,13 @@ HTABLE_PROTOTYPE(htp, note_gc_hash)
char *generate_note(const char *str) char *generate_note(const char *str)
{ {
char *sha1 = mem_malloc(SHA1_DIGESTLEN * 2 + 1); char *sha1 = mem_malloc(SHA1_DIGESTLEN * 2 + 1);
char *notepath; char *notepath, *s;
FILE *fp; FILE *fp;
/* Temporary hack */
asprintf(&s, "%s\n", str);
str = s;
sha1_digest(str, sha1); sha1_digest(str, sha1);
asprintf(&notepath, "%s%s", path_notes, sha1); asprintf(&notepath, "%s%s", path_notes, sha1);
fp = fopen(notepath, "w"); fp = fopen(notepath, "w");
@ -70,6 +74,7 @@ char *generate_note(const char *str)
fputs(str, fp); fputs(str, fp);
file_close(fp, __FILE_POS__); file_close(fp, __FILE_POS__);
mem_free(s);
mem_free(notepath); mem_free(notepath);
return sha1; return sha1;
} }