aboutsummaryrefslogtreecommitdiff
path: root/libsylph/pop.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-09-14 08:14:53 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-09-14 08:14:53 +0000
commit39107c8161a25feebadc1cb9a86b9631f5be6eb1 (patch)
treea3a972e60c7c71e2c22bc643d6c13271b2ce7cb6 /libsylph/pop.c
parent54d009488f25c9902d610bf3af01c4c28dbd964c (diff)
protect uidl file on disk full.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1164 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph/pop.c')
-rw-r--r--libsylph/pop.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libsylph/pop.c b/libsylph/pop.c
index 1a5bd7fd..143bb89d 100644
--- a/libsylph/pop.c
+++ b/libsylph/pop.c
@@ -35,6 +35,7 @@
#include "pop.h"
#include "md5.h"
+#include "prefs.h"
#include "prefs_account.h"
#include "utils.h"
#include "recv.h"
@@ -504,7 +505,7 @@ GHashTable *pop3_get_uidl_table(PrefsAccount *ac_prefs)
gint pop3_write_uidl_list(Pop3Session *session)
{
gchar *path;
- FILE *fp;
+ PrefFile *pfile;
Pop3MsgInfo *msg;
gint n;
gchar *uid;
@@ -517,8 +518,7 @@ gint pop3_write_uidl_list(Pop3Session *session)
session->ac_prefs->recv_server,
"-", uid, NULL);
g_free(uid);
- if ((fp = g_fopen(path, "wb")) == NULL) {
- FILE_OP_ERROR(path, "fopen");
+ if ((pfile = prefs_file_open(path)) == NULL) {
g_free(path);
return -1;
}
@@ -529,10 +529,12 @@ gint pop3_write_uidl_list(Pop3Session *session)
continue;
if (session->state == POP3_DONE && msg->deleted)
continue;
- fprintf(fp, "%s\t%ld\n", msg->uidl, msg->recv_time);
+ fprintf(pfile->fp, "%s\t%ld\n", msg->uidl, msg->recv_time);
}
- if (fclose(fp) == EOF) FILE_OP_ERROR(path, "fclose");
+ if (prefs_file_close(pfile) < 0)
+ g_warning("%s: failed to write UIDL list.\n", path);
+
g_free(path);
return 0;