summaryrefslogtreecommitdiff
path: root/src/pwl.c
diff options
context:
space:
mode:
authorEric Albright <eric_albright@sil.org>2008-05-02 06:02:12 +0000
committerEric Albright <eric_albright@sil.org>2008-05-02 06:02:12 +0000
commit0ed48af1f728561b45969096c698e900a600028e (patch)
tree515de40a8deb904efb97a90330c5c77f4585bfb7 /src/pwl.c
parentf04f81e52d73fce51d5f2451bd0a2825b8c15caa (diff)
downloadenchant-0ed48af1f728561b45969096c698e900a600028e.tar.gz
Fixes case where if a personal dictionary was edited such that it didn't end with a trailing new line, adding a word would not work correctly.
git-svn-id: svn+ssh://svn.abisource.com/svnroot/enchant/trunk@23735 bcba8976-2d24-0410-9c9c-aab3bd5fdfd6
Diffstat (limited to 'src/pwl.c')
-rw-r--r--src/pwl.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/pwl.c b/src/pwl.c
index a0e364e..7138710 100644
--- a/src/pwl.c
+++ b/src/pwl.c
@@ -388,8 +388,11 @@ void enchant_pwl_add(EnchantPWL *pwl,
if(g_stat(pwl->filename, &stats)==0)
pwl->file_changed = stats.st_mtime;
- fwrite (word, sizeof(char), len, f);
+ /* we write the new line first since we can't guarantee
+ that the file was terminated by a new line before
+ and we are just appending to the end of the file */
fwrite ("\n", sizeof(char), 1, f);
+ fwrite (word, sizeof(char), len, f);
enchant_unlock_file (f);
fclose (f);
}