path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
"uidl", G_DIR_SEPARATOR_S, msginfo->account_server,
"-", msginfo->account_login, NULL);
- if ((fp = fopen(path, "rb")) == NULL) {
+ if ((fp = g_fopen(path, "rb")) == NULL) {
if (ENOENT != errno) FILE_OP_ERROR(path, "fopen");
g_free(path);
path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
"uidl-", msginfo->account_server,
"-", sanitized_uid, NULL);
- if ((fp = fopen(path, "rb")) == NULL) {
+ if ((fp = g_fopen(path, "rb")) == NULL) {
if (ENOENT != errno) FILE_OP_ERROR(path, "fopen");
g_free(sanitized_uid);
g_free(path);
recv_time = RECV_TIME_NONE;
partial_recv = POP3_TOTALLY_RECEIVED;
- if (sscanf(buf, "%s\t%ld\t%s", uidl, &recv_time, tmp) < 2) {
+ if (sscanf(buf, "%s\t%ld\t%s", uidl, (long int *) &recv_time,
+ tmp) < 2) {
if (sscanf(buf, "%s", uidl) != 1)
continue;
else {
int err = -1;
gchar *filename;
MsgInfo *tinfo;
- gchar *sanitized_uid = g_strdup(tinfo->account_login);
-
- subst_for_filename(sanitized_uid);
-
+ gchar *sanitized_uid = NULL;
filename = procmsg_get_message_file_path(msginfo);
if (!filename) {
}
tinfo = procheader_parse_file(filename, msginfo->flags, TRUE, TRUE);
+ sanitized_uid = g_strdup(tinfo->account_login);
+ subst_for_filename(sanitized_uid);
+
if (!tinfo->account_server
|| !tinfo->account_login
|| !tinfo->partial_recv) {
"uidl", G_DIR_SEPARATOR_S, tinfo->account_server,
"-", sanitized_uid, NULL);
- if ((fp = fopen(path, "rb")) == NULL) {
+ if ((fp = g_fopen(path, "rb")) == NULL) {
perror("fopen1");
if (ENOENT != errno) FILE_OP_ERROR(path, "fopen");
g_free(path);
path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
"uidl-", tinfo->account_server,
"-", tinfo->account_login, NULL);
- if ((fp = fopen(path, "rb")) == NULL) {
+ if ((fp = g_fopen(path, "rb")) == NULL) {
if (ENOENT != errno) FILE_OP_ERROR(path, "fopen");
g_free(path);
}
g_free(sanitized_uid);
- if ((fpnew = fopen(pathnew, "wb")) == NULL) {
+ if ((fpnew = g_fopen(pathnew, "wb")) == NULL) {
perror("fopen2");
fclose(fp);
g_free(pathnew);
sprintf(partial_recv,"0");
if (sscanf(buf, "%s\t%ld\t%s",
- uidl, &recv_time, partial_recv) < 2) {
+ uidl, (long int *) &recv_time, partial_recv) < 2) {
if (sscanf(buf, "%s", uidl) != 1)
continue;
else {
}
if (strcmp(tinfo->partial_recv, uidl)) {
fprintf(fpnew, "%s\t%ld\t%s\n",
- uidl, recv_time, partial_recv);
+ uidl, (long int) recv_time, partial_recv);
} else {
gchar *stat = NULL;
if (download == POP3_PARTIAL_DLOAD_DLOAD) {
stat = g_strdup("0");
fprintf(fpnew, "%s\t%ld\t%s\n",
- uidl, recv_time, stat);
+ uidl, (long int) recv_time, stat);
g_free(stat);
}
}
g_free(path);
g_free(pathnew);
- if ((fp = fopen(filename,"rb")) == NULL) {
+ if ((fp = g_fopen(filename,"rb")) == NULL) {
perror("fopen3");
goto bail;
}
pathnew = g_strdup_printf("%s.new", filename);
- if ((fpnew = fopen(pathnew, "wb")) == NULL) {
+ if ((fpnew = g_fopen(pathnew, "wb")) == NULL) {
perror("fopen4");
fclose(fp);
g_free(pathnew);
}
fclose(fpnew);
fclose(fp);
- unlink(filename);
+ g_unlink(filename);
rename(pathnew, filename);
g_free(pathnew);
msginfo->planned_download = download;
path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
"uidl", G_DIR_SEPARATOR_S,
server, "-", sanitized_uid, NULL);
- if ((fp = fopen(path, "rb")) == NULL) {
+ if ((fp = g_fopen(path, "rb")) == NULL) {
if (ENOENT != errno) FILE_OP_ERROR(path, "fopen");
g_free(path);
path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
"uidl-", server,
"-", sanitized_uid, NULL);
- if ((fp = fopen(path, "rb")) == NULL) {
+ if ((fp = g_fopen(path, "rb")) == NULL) {
if (ENOENT != errno) FILE_OP_ERROR(path, "fopen");
g_free(sanitized_uid);
g_free(path);
recv_time = RECV_TIME_NONE;
partial_recv = POP3_TOTALLY_RECEIVED;
- if (sscanf(buf, "%s\t%ld\t%s", uidl, &recv_time, tmp) < 2) {
+ if (sscanf(buf, "%s\t%ld\t%s", uidl, (long int *) &recv_time,
+ tmp) < 2) {
if (sscanf(buf, "%s", uidl) != 1)
continue;
else {