summaryrefslogtreecommitdiffstats
path: root/src/storage/ngram.cpp
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-10-27 18:05:44 +0800
committerPeng Wu <alexepico@gmail.com>2011-10-27 18:05:44 +0800
commit85a934c958a036d17b548919d2264825eae8a68b (patch)
tree9560c6a55aace9baf4646d27d07835c0446ed42a /src/storage/ngram.cpp
parentb6ddd796eb5169cb372c9baf63607dcc02458d30 (diff)
downloadlibpinyin-85a934c958a036d17b548919d2264825eae8a68b.tar.gz
libpinyin-85a934c958a036d17b548919d2264825eae8a68b.tar.xz
libpinyin-85a934c958a036d17b548919d2264825eae8a68b.zip
fixes save_db
Diffstat (limited to 'src/storage/ngram.cpp')
-rw-r--r--src/storage/ngram.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/storage/ngram.cpp b/src/storage/ngram.cpp
index fedd744..f7dd347 100644
--- a/src/storage/ngram.cpp
+++ b/src/storage/ngram.cpp
@@ -20,6 +20,7 @@
*/
#include <stdio.h>
+#include <errno.h>
#include <glib.h>
#include <glib/gstdio.h>
#include "memory_chunk.h"
@@ -273,7 +274,7 @@ bool Bigram::save_db(const char * dbfile){
DB * tmp_db = NULL;
int ret = g_unlink(dbfile);
- if ( ret != 0 )
+ if ( ret != 0 && errno != ENOENT)
return false;
ret = db_create(&tmp_db, NULL, 0);