+lease complete the changelog entry below
+2008-04-18 [colin] 3.4.0cvs1
+
+ * src/addrduplicates.c
+ * src/addressbook.c
+ * src/compose.c
+ * src/crash.c
+ * src/editaddress.c
+ * src/folder.c
+ * src/image_viewer.c
+ * src/imap.c
+ * src/inc.c
+ * src/main.c
+ * src/mbox.c
+ * src/messageview.c
+ * src/mh.c
+ * src/msgcache.c
+ * src/news.c
+ * src/partial_download.c
+ * src/pop.c
+ * src/prefs_common.c
+ * src/prefs_common.h
+ * src/prefs_other.c
+ * src/prefs_themes.c
+ * src/procheader.c
+ * src/procmime.c
+ * src/procmsg.c
+ * src/textview.c
+ * src/wizard.c
+ * src/common/prefs.c
+ * src/common/ssl_certificate.c
+ * src/common/template.c
+ * src/common/utils.c
+ * src/common/utils.h
+ * src/etpan/imap-thread.c
+ * src/plugins/dillo_viewer/dillo_viewer.c
+ * src/plugins/pgpcore/sgpgme.c
+ * src/plugins/pgpinline/pgpinline.c
+ Add an option to shred temporary files and messages
+ instead of just removing them. Slows deletions down!
+
2008-04-18 [paul] 3.4.0
* NEWS
( cvs diff -u -r 1.179.2.215 -r 1.179.2.216 src/imap.c; cvs diff -u -r 1.395.2.363 -r 1.395.2.364 src/summaryview.c; ) > 3.3.1cvs59.patchset
( cvs diff -u -r 1.42.2.36 -r 1.42.2.37 po/fr.po; ) > 3.3.1cvs60.patchset
( cvs diff -u -r 1.58.2.37 -r 1.58.2.38 po/de.po; cvs diff -u -r 1.1.2.17 -r 1.1.2.18 po/fi.po; cvs diff -u -r 1.34.2.26 -r 1.34.2.27 po/it.po; cvs diff -u -r 1.50.2.30 -r 1.50.2.31 po/pt_BR.po; ) > 3.3.1cvs61.patchset
+( cvs diff -u -r 1.1.2.9 -r 1.1.2.10 src/addrduplicates.c; cvs diff -u -r 1.60.2.114 -r 1.60.2.115 src/addressbook.c; cvs diff -u -r 1.382.2.442 -r 1.382.2.443 src/compose.c; cvs diff -u -r 1.23.2.28 -r 1.23.2.29 src/crash.c; cvs diff -u -r 1.14.2.48 -r 1.14.2.49 src/editaddress.c; cvs diff -u -r 1.213.2.180 -r 1.213.2.181 src/folder.c; cvs diff -u -r 1.1.2.20 -r 1.1.2.21 src/image_viewer.c; cvs diff -u -r 1.179.2.216 -r 1.179.2.217 src/imap.c; cvs diff -u -r 1.149.2.86 -r 1.149.2.87 src/inc.c; cvs diff -u -r 1.115.2.193 -r 1.115.2.194 src/main.c; cvs diff -u -r 1.28.2.42 -r 1.28.2.43 src/mbox.c; cvs diff -u -r 1.94.2.174 -r 1.94.2.175 src/messageview.c; cvs diff -u -r 1.79.2.64 -r 1.79.2.65 src/mh.c; cvs diff -u -r 1.16.2.61 -r 1.16.2.62 src/msgcache.c; cvs diff -u -r 1.101.2.49 -r 1.101.2.50 src/news.c; cvs diff -u -r 1.1.2.21 -r 1.1.2.22 src/partial_download.c; cvs diff -u -r 1.56.2.60 -r 1.56.2.61 src/pop.c; cvs diff -u -r 1.204.2.163 -r 1.204.2.164 src/prefs_common.c; cvs diff -u -r 1.103.2.105 -r 1.103.2.106 src/prefs_common.h; cvs diff -u -r 1.1.2.28 -r 1.1.2.29 src/prefs_other.c; cvs diff -u -r 1.3.2.54 -r 1.3.2.55 src/prefs_themes.c; cvs diff -u -r 1.47.2.47 -r 1.47.2.48 src/procheader.c; cvs diff -u -r 1.49.2.108 -r 1.49.2.109 src/procmime.c; cvs diff -u -r 1.150.2.108 -r 1.150.2.109 src/procmsg.c; cvs diff -u -r 1.96.2.199 -r 1.96.2.200 src/textview.c; cvs diff -u -r 1.1.2.68 -r 1.1.2.69 src/wizard.c; cvs diff -u -r 1.5.2.11 -r 1.5.2.12 src/common/prefs.c; cvs diff -u -r 1.4.2.25 -r 1.4.2.26 src/common/ssl_certificate.c; cvs diff -u -r 1.2.4.27 -r 1.2.4.28 src/common/template.c; cvs diff -u -r 1.36.2.136 -r 1.36.2.137 src/common/utils.c; cvs diff -u -r 1.20.2.60 -r 1.20.2.61 src/common/utils.h; cvs diff -u -r 1.1.4.98 -r 1.1.4.99 src/etpan/imap-thread.c; cvs diff -u -r 1.12.2.25 -r 1.12.2.26 src/plugins/dillo_viewer/dillo_viewer.c; cvs diff -u -r 1.1.2.48 -r 1.1.2.49 src/plugins/pgpcore/sgpgme.c; cvs diff -u -r 1.1.2.38 -r 1.1.2.39 src/plugins/pgpinline/pgpinline.c; ) > 3.4.0cvs1.patchset
MICRO_VERSION=0
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=0
+EXTRA_VERSION=1
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
if(item) {
gchar *filename = addritem_person_get_picture(item);
if (filename && is_file_exist(filename))
- g_unlink(filename);
+ claws_unlink(filename);
g_free(filename);
addritem_free_item_person(item);
}
if( item ) {
gchar *filename = addritem_person_get_picture(item);
if (filename && is_file_exist(filename))
- g_unlink(filename);
+ claws_unlink(filename);
g_free(filename);
addritem_free_item_person( item );
}
else {
gchar *orig_file = g_strconcat(origdir, G_DIR_SEPARATOR_S,
d->d_name, NULL);
- g_unlink(orig_file);
+ claws_unlink(orig_file);
g_free(orig_file);
}
}
tmppath = g_strconcat(path, ".tmp", NULL);
if (fclose(fp) == EOF) {
FILE_OP_ERROR(tmppath, "fclose");
- g_unlink(tmppath);
+ claws_unlink(tmppath);
g_free(path);
g_free(tmppath);
return -1;
if (is_file_exist(path)) {
bakpath = g_strconcat(path, ".bak", NULL);
#ifdef G_OS_WIN32
- g_unlink(bakpath);
+ claws_unlink(bakpath);
#endif
if (rename(path, bakpath) < 0) {
FILE_OP_ERROR(path, "rename");
- g_unlink(tmppath);
+ claws_unlink(tmppath);
g_free(path);
g_free(tmppath);
g_free(bakpath);
}
#ifdef G_OS_WIN32
- g_unlink(path);
+ claws_unlink(path);
#endif
if (rename(tmppath, path) < 0) {
FILE_OP_ERROR(tmppath, "rename");
- g_unlink(tmppath);
+ claws_unlink(tmppath);
g_free(path);
g_free(tmppath);
g_free(bakpath);
tmppath = g_strconcat(pfile->path, ".tmp", NULL);
fclose(pfile->fp);
if (pfile->writing) {
- if (g_unlink(tmppath) < 0) FILE_OP_ERROR(tmppath, "unlink");
+ if (claws_unlink(tmppath) < 0) FILE_OP_ERROR(tmppath, "unlink");
g_free(tmppath);
}
g_free(pfile->path);
gchar *file;
buf = g_strdup_printf("%d", cert->port);
file = get_certificate_path(cert->host, buf, cert->fingerprint);
- g_unlink (file);
+ claws_unlink (file);
g_free(file);
g_free(buf);
}
{ \
g_warning("Failed to write template to file\n"); \
if (fp) fclose(fp); \
- if (new) g_unlink(new); \
+ if (new) claws_unlink(new); \
g_free(new); \
g_free(filename); \
return; \
TRY(fclose(fp) != EOF);
if (new) {
- g_unlink(filename);
+ claws_unlink(filename);
rename_force(new, filename);
}
g_free(new);
itos(tmpl_num), NULL);
if (is_file_exist(filename)) {
debug_print("removing old template %d\n", tmpl_num);
- g_unlink(filename);
+ claws_unlink(filename);
g_free(filename);
} else {
g_free(filename);
return 0;
unlinkout:
- g_unlink(out);
+ claws_unlink(out);
freeout:
g_free(out);
return -1;
}
while ((dir_name = g_dir_read_name(dp)) != NULL) {
- if (g_unlink(dir_name) < 0)
+ if (claws_unlink(dir_name) < 0)
FILE_OP_ERROR(dir_name, "unlink");
}
if (file_no > 0 && first <= file_no && file_no <= last) {
if (is_dir_exist(dir_name))
continue;
- if (g_unlink(dir_name) < 0)
+ if (claws_unlink(dir_name) < 0)
FILE_OP_ERROR(dir_name, "unlink");
}
}
debug_print("removing unwanted file %d from %s\n", file_no, dir);
if (is_dir_exist(dir_name))
continue;
- if (g_unlink(dir_name) < 0)
+ if (claws_unlink(dir_name) < 0)
FILE_OP_ERROR(dir_name, "unlink");
}
}
}
if (!S_ISDIR(s.st_mode)) {
- if (g_unlink(dir) < 0) {
+ if (claws_unlink(dir) < 0) {
FILE_OP_ERROR(dir, "unlink");
return -1;
}
return -1;
}
} else {
- if (g_unlink(dir_name) < 0)
+ if (claws_unlink(dir_name) < 0)
FILE_OP_ERROR(dir_name, "unlink");
}
}
return -1;
}
if (is_file_exist(newpath)) {
- if (g_unlink(newpath) < 0)
+ if (claws_unlink(newpath) < 0)
FILE_OP_ERROR(newpath, "unlink");
}
#endif
g_warning("writing to %s failed.\n", dest);
fclose(dest_fp);
fclose(src_fp);
- g_unlink(dest);
+ claws_unlink(dest);
return -1;
}
}
}
if (err) {
- g_unlink(dest);
+ claws_unlink(dest);
return -1;
}
g_warning("writing to %s failed.\n", dest);
fclose(dest_fp);
fclose(src_fp);
- g_unlink(dest);
+ claws_unlink(dest);
if (dest_bak) {
if (rename_force(dest_bak, dest) < 0)
FILE_OP_ERROR(dest_bak, "rename");
}
if (err) {
- g_unlink(dest);
+ claws_unlink(dest);
if (dest_bak) {
if (rename_force(dest_bak, dest) < 0)
FILE_OP_ERROR(dest_bak, "rename");
}
if (keep_backup == FALSE && dest_bak)
- g_unlink(dest_bak);
+ claws_unlink(dest_bak);
g_free(dest_bak);
if (copy_file(src, dest, FALSE) < 0) return -1;
- g_unlink(src);
+ claws_unlink(src);
return 0;
}
if (err) {
g_warning("writing to %s failed.\n", dest);
- g_unlink(dest);
+ claws_unlink(dest);
return -1;
}
g_warning("writing to %s failed.\n", dest);
fclose(dest_fp);
fclose(src_fp);
- g_unlink(dest);
+ claws_unlink(dest);
return -1;
}
}
}
if (err) {
- g_unlink(dest);
+ claws_unlink(dest);
return -1;
}
if (move_file(tmp_file, file, TRUE) < 0) {
g_warning("can't replace %s .\n", file);
- g_unlink(tmp_file);
+ claws_unlink(tmp_file);
g_free(tmp_file);
return -1;
}
return tmpfile();
#ifndef G_OS_WIN32
- g_unlink(fname);
+ claws_unlink(fname);
/* verify that we can write in the file after unlinking */
if (write(fd, buf, 1) < 0) {
if (fwrite(str, 1, len, fp) != len) {
FILE_OP_ERROR(file, "fwrite");
fclose(fp);
- g_unlink(file);
+ claws_unlink(file);
return -1;
}
if (fclose(fp) == EOF) {
FILE_OP_ERROR(file, "fclose");
- g_unlink(file);
+ claws_unlink(file);
return -1;
}
*curpos++ = '\0';
return total_done;
}
+
+gboolean prefs_common_get_use_shred(void);
+
+int claws_unlink(const gchar *filename)
+{
+ struct stat s;
+ static int found_shred = -1;
+ static const gchar *args[4];
+
+ if (found_shred == -1) {
+ /* init */
+ args[0] = g_find_program_in_path("shred");
+ debug_print("found shred: %s\n", args[0]);
+ found_shred = (args[0] != NULL) ? 1:0;
+ args[1] = "-f";
+ args[3] = NULL;
+ }
+ if (found_shred == 1 && prefs_common_get_use_shred()) {
+ if (is_file_exist(filename) && g_stat(filename, &s) == 0) {
+ if (s.st_nlink == 1) {
+ gint status=0;
+ args[2] = filename;
+ g_spawn_sync(NULL, (gchar **)args, NULL, 0,
+ NULL, NULL, NULL, NULL, &status, NULL);
+ debug_print("%s %s exited with status %d\n",
+ args[0], filename, WEXITSTATUS(status));
+ truncate(filename, 0);
+ }
+ }
+ }
+ return g_unlink(filename);
+}
#define g_mkdir mkdir
#define g_stat stat
#define g_lstat lstat
-#define g_unlink unlink
+#define claws_unlink unlink
#define g_remove remove
#define g_rmdir rmdir
#define g_fopen fopen
gboolean file_is_email(const gchar *filename);
gboolean sc_g_list_bigger(GList *list, gint max);
gboolean sc_g_slist_bigger(GSList *list, gint max);
+
+int claws_unlink(const gchar *filename);
#ifdef __cplusplus
}
#endif
g_free(msgpath);
} else {
val = procmsg_send_message_queue(msgpath, &errstr, folder, msgnum, &queued_removed);
- g_unlink(msgpath);
+ claws_unlink(msgpath);
g_free(msgpath);
}
if (!discard_window) {
FILE_OP_ERROR(file, "fwrite");
g_free(chars);
fclose(fp);
- g_unlink(file);
+ claws_unlink(file);
return -1;
}
if (fclose(fp) == EOF) {
FILE_OP_ERROR(file, "fclose");
- g_unlink(file);
+ claws_unlink(file);
return -1;
}
return 0;
if (!compose_warn_encryption(compose)) {
lock = FALSE;
fclose(fp);
- g_unlink(tmp);
+ claws_unlink(tmp);
g_free(tmp);
return -6;
}
* key selection */
lock = FALSE;
fclose(fp);
- g_unlink(tmp);
+ claws_unlink(tmp);
g_free(tmp);
return -5;
}
if (compose_redirect_write_to_file(compose, fp) < 0) {
lock = FALSE;
fclose(fp);
- g_unlink(tmp);
+ claws_unlink(tmp);
g_free(tmp);
return -2;
}
if ((result = compose_write_to_file(compose, fp, COMPOSE_WRITE_FOR_SEND, TRUE)) < 0) {
lock = FALSE;
fclose(fp);
- g_unlink(tmp);
+ claws_unlink(tmp);
g_free(tmp);
return result - 1; /* -2 for a generic error, -3 for signing error, -4 for encoding */
}
if (err == TRUE) {
g_warning("failed to write queue message\n");
fclose(fp);
- g_unlink(tmp);
+ claws_unlink(tmp);
g_free(tmp);
lock = FALSE;
return -2;
}
if (fclose(fp) == EOF) {
FILE_OP_ERROR(tmp, "fclose");
- g_unlink(tmp);
+ claws_unlink(tmp);
g_free(tmp);
lock = FALSE;
return -2;
}
if (!queue) {
g_warning("can't find queue folder\n");
- g_unlink(tmp);
+ claws_unlink(tmp);
g_free(tmp);
lock = FALSE;
return -1;
folder_item_scan(queue);
if ((num = folder_item_add_msg(queue, tmp, NULL, FALSE)) < 0) {
g_warning("can't queue the message\n");
- g_unlink(tmp);
+ claws_unlink(tmp);
g_free(tmp);
lock = FALSE;
return -1;
}
if (msgpath == NULL) {
- g_unlink(tmp);
+ claws_unlink(tmp);
g_free(tmp);
} else
*msgpath = tmp;
compose_insert_file(compose, compose->exteditor_file);
compose_changed_cb(NULL, compose);
- if (g_unlink(compose->exteditor_file) < 0)
+ if (claws_unlink(compose->exteditor_file) < 0)
FILE_OP_ERROR(compose->exteditor_file, "unlink");
} else if (buf[0] == '1') { /* failed */
g_warning("Couldn't exec external editor\n");
- if (g_unlink(compose->exteditor_file) < 0)
+ if (claws_unlink(compose->exteditor_file) < 0)
FILE_OP_ERROR(compose->exteditor_file, "unlink");
} else if (buf[0] == '2') {
g_warning("Couldn't write to file\n");
}
if (msgnum < 0) {
warn_err:
- g_unlink(tmp);
+ claws_unlink(tmp);
g_free(tmp);
if (action != COMPOSE_AUTO_SAVE) {
if (action != COMPOSE_DRAFT_FOR_EXIT)
gchar *filepath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
DRAFTED_AT_EXIT, NULL);
if (is_file_exist(filepath))
- g_unlink(filepath);
+ claws_unlink(filepath);
g_free(filepath);
}
str_write_to_file(tmpdata, tmpfile);
g_free(tmpdata);
compose_insert_file(compose, tmpfile);
- g_unlink(tmpfile);
+ claws_unlink(tmpfile);
g_free(tmpfile);
gtk_drag_finish(drag_context, TRUE, FALSE, time);
compose_beautify_paragraph(compose, NULL, TRUE);
gchar *tmpfile = get_tmp_file();
str_write_to_file((const gchar *)data->data, tmpfile);
compose_insert_file(compose, tmpfile);
- g_unlink(tmpfile);
+ claws_unlink(tmpfile);
g_free(tmpfile);
gtk_drag_finish(drag_context, TRUE, FALSE, time);
#endif
static void crash_cleanup_exit(void)
{
const char *filename = claws_get_socket_name();
- g_unlink(filename);
+ claws_unlink(filename);
}
#endif
else
name = g_strconcat( get_rc_dir(), G_DIR_SEPARATOR_S, ADDRBOOK_DIR, G_DIR_SEPARATOR_S,
current_person->picture, ".png", NULL );
- g_unlink(name);
+ claws_unlink(name);
g_free(name);
}
name = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_first), 0, -1 );
close:
close(fd);
unlink:
- g_unlink(param->filename);
+ claws_unlink(param->filename);
free:
/* mmap_string_unref is a simple free in libetpan
lastnum = num;
if (num >= 0 && remove_source) {
- if (g_unlink(fileinfo->file) < 0)
+ if (claws_unlink(fileinfo->file) < 0)
FILE_OP_ERROR(fileinfo->file, "unlink");
}
cache = folder_item_get_cache_file(item);
if (is_file_exist(cache))
- g_unlink(cache);
+ claws_unlink(cache);
g_free(cache);
}
return;
}
image_viewer_load_file(imageviewer, imgfile);
- g_unlink(imgfile);
+ claws_unlink(imgfile);
g_free(imgfile);
}
g_free(path);
if (is_file_exist(filename)) {
- g_unlink(filename);
+ claws_unlink(filename);
}
g_free(filename);
}
} else
inbox = folder_get_default_inbox();
if (!inbox) {
- g_unlink(file);
+ claws_unlink(file);
return -1;
}
/* add msg file to drop folder */
if ((msgnum = folder_item_add_msg(
dropfolder, file, NULL, TRUE)) < 0) {
- g_unlink(file);
+ claws_unlink(file);
return -1;
}
msgs = proc_mbox(dest, tmp_mbox, account->filter_on_recv, account);
- g_unlink(tmp_mbox);
+ claws_unlink(tmp_mbox);
if (msgs >= 0) empty_mbox(mbox);
unlock_mbox(mbox, lockfd, LOCK_FLOCK);
#endif
/* delete crashfile */
if (!cmd.crash)
- g_unlink(get_crashfile_name());
+ claws_unlink(get_crashfile_name());
lock_socket_remove();
x_display = g_strdup(g_getenv("DISPLAY"));
if (uxsock < 0) {
- g_unlink(path);
+ claws_unlink(path);
return fd_open_unix(path);
}
}
fd_close(lock_socket);
filename = claws_get_socket_name();
- g_unlink(filename);
+ claws_unlink(filename);
#endif
return 0;
g_warning("can't write to temporary file\n"); \
fclose(tmp_fp); \
fclose(mbox_fp); \
- g_unlink(tmp_file); \
+ claws_unlink(tmp_file); \
g_free(tmp_file); \
return -1; \
} \
g_warning("malformed mbox: %s: message %d is empty\n", mbox, msgs);
fclose(tmp_fp);
fclose(mbox_fp);
- g_unlink(tmp_file);
+ claws_unlink(tmp_file);
return -1;
}
FILE_OP_ERROR(tmp_file, "fclose");
g_warning("can't write to temporary file\n");
fclose(mbox_fp);
- g_unlink(tmp_file);
+ claws_unlink(tmp_file);
g_free(tmp_file);
return -1;
}
if (apply_filter) {
if ((msgnum = folder_item_add_msg(dropfolder, tmp_file, NULL, TRUE)) < 0) {
fclose(mbox_fp);
- g_unlink(tmp_file);
+ claws_unlink(tmp_file);
g_free(tmp_file);
return -1;
}
FILE_OP_ERROR(lockfile, "link");
if (retry >= 5) {
g_warning("can't create %s\n", lockfile);
- g_unlink(lockfile);
+ claws_unlink(lockfile);
g_free(lockfile);
return -1;
}
retry++;
sleep(5);
}
- g_unlink(lockfile);
+ claws_unlink(lockfile);
g_free(lockfile);
} else if (type == LOCK_FLOCK) {
gint lockfd;
gchar *lockfile;
lockfile = g_strconcat(base, ".lock", NULL);
- if (g_unlink(lockfile) < 0) {
+ if (claws_unlink(lockfile) < 0) {
FILE_OP_ERROR(lockfile, "unlink");
g_free(lockfile);
return -1;
if (fwrite(buf, 1, n_read, dest_fp) < n_read) {
g_warning("writing to %s failed.\n", dest);
fclose(dest_fp);
- g_unlink(dest);
+ claws_unlink(dest);
return -1;
}
}
}
if (err) {
- g_unlink(dest);
+ claws_unlink(dest);
return -1;
}
addrp) < 0) {
g_free(addrp);
fclose(fp);
- g_unlink(tmp);
+ claws_unlink(tmp);
return -1;
}
if (fprintf(fp, "SCF:%s\n", path) < 0) {
g_free(path);
fclose(fp);
- g_unlink(tmp);
+ claws_unlink(tmp);
return -1;
}
g_free(path);
if (fprintf(fp, "X-Claws-End-Special-Headers: 1\n") < 0) {
fclose(fp);
- g_unlink(tmp);
+ claws_unlink(tmp);
return -1;
}
get_rfc822_date(buf, sizeof(buf));
if (fprintf(fp, "Date: %s\n", buf) < 0) {
fclose(fp);
- g_unlink(tmp);
+ claws_unlink(tmp);
return -1;
}
strlen("From: "));
if (fprintf(fp, "From: %s <%s>\n", buf, account->address) < 0) {
fclose(fp);
- g_unlink(tmp);
+ claws_unlink(tmp);
return -1;
}
} else
if (fprintf(fp, "From: %s\n", account->address) < 0) {
fclose(fp);
- g_unlink(tmp);
+ claws_unlink(tmp);
return -1;
}
if (fprintf(fp, "To: %s\n", to) < 0) {
fclose(fp);
- g_unlink(tmp);
+ claws_unlink(tmp);
return -1;
}
strlen("Subject: "));
if (fprintf(fp, "Subject: Disposition notification: %s\n", buf) < 0) {
fclose(fp);
- g_unlink(tmp);
+ claws_unlink(tmp);
return -1;
}
if (fprintf(fp, "Message-ID: <%s>\n", buf) < 0) {
fclose(fp);
- g_unlink(tmp);
+ claws_unlink(tmp);
return -1;
}
}
msginfo->msgid?msginfo->msgid:"NO MESSAGE ID",
boundary) < 0) {
fclose(fp);
- g_unlink(tmp);
+ claws_unlink(tmp);
g_free(boundary);
return -1;
}
if (fclose(fp) == EOF) {
FILE_OP_ERROR(tmp, "fclose");
- g_unlink(tmp);
+ claws_unlink(tmp);
return -1;
}
if (!queue) queue = folder_get_default_queue();
if (!queue) {
g_warning("can't find queue folder\n");
- g_unlink(tmp);
+ claws_unlink(tmp);
return -1;
}
folder_item_scan(queue);
if ((num = folder_item_add_msg(queue, tmp, NULL, TRUE)) < 0) {
g_warning("can't queue the message\n");
- g_unlink(tmp);
+ claws_unlink(tmp);
return -1;
}
need_scan = mh_scan_required(folder, item);
last_mtime = item->mtime;
- if (g_unlink(file) < 0) {
+ if (claws_unlink(file) < 0) {
FILE_OP_ERROR(file, "unlink");
g_free(file);
return -1;
if (file == NULL)
continue;
- if (g_unlink(file) < 0) {
+ if (claws_unlink(file) < 0) {
g_free(file);
continue;
}
if (w_err != 0) {
g_warning("failed to write charset\n");
fclose(write_fps.cache_fp);
- g_unlink(new_cache);
+ claws_unlink(new_cache);
g_free(new_cache);
g_free(new_mark);
g_free(new_tags);
DATA_WRITE, NULL, 0);
if (write_fps.mark_fp == NULL) {
fclose(write_fps.cache_fp);
- g_unlink(new_cache);
+ claws_unlink(new_cache);
g_free(new_cache);
g_free(new_mark);
g_free(new_tags);
if (write_fps.tags_fp == NULL) {
fclose(write_fps.cache_fp);
fclose(write_fps.mark_fp);
- g_unlink(new_cache);
- g_unlink(new_mark);
+ claws_unlink(new_cache);
+ claws_unlink(new_mark);
g_free(new_cache);
g_free(new_mark);
g_free(new_tags);
if (write_fps.error != 0) {
- g_unlink(new_cache);
- g_unlink(new_mark);
- g_unlink(new_tags);
+ claws_unlink(new_cache);
+ claws_unlink(new_mark);
+ claws_unlink(new_tags);
g_free(new_cache);
g_free(new_mark);
g_free(new_tags);
filename = g_strconcat(path, G_DIR_SEPARATOR_S, itos(msgnum), NULL);
g_free(path);
- g_unlink(filename);
+ claws_unlink(filename);
g_free(filename);
return 0;
}
g_free(path);
if (is_file_exist(filename)) {
- g_unlink(filename);
+ claws_unlink(filename);
}
g_free(filename);
}
buf) < 0) {
FILE_OP_ERROR(tmp, "fprintf");
fclose(tmpfp);
- g_unlink(tmp);
+ claws_unlink(tmp);
g_free(tmp);
return -1;
}
if (fclose(tmpfp) == EOF) {
FILE_OP_ERROR(tmp, "fclose");
- g_unlink(tmp);
+ claws_unlink(tmp);
g_free(tmp);
return -1;
}
}
fclose(fp);
- g_unlink(filename);
+ claws_unlink(filename);
rename(pathnew, filename);
g_free(pathnew);
msginfo->planned_download = download;
debug_print("dillo_show_mimepart\n");
if (viewer->filename != NULL) {
- g_unlink(viewer->filename);
+ claws_unlink(viewer->filename);
g_free(viewer->filename);
}
}
gtk_widget_unref(GTK_WIDGET(viewer->widget));
- g_unlink(viewer->filename);
+ claws_unlink(viewer->filename);
g_free(viewer->filename);
g_free(viewer);
}
debug_print("tmp file %s\n", tmp_file);
err = gpgme_data_new_from_file(&data, tmp_file, 1);
- g_unlink(tmp_file);
+ claws_unlink(tmp_file);
g_free(tmp_file);
debug_print("data %p (%d %d)\n", (void *)&data, mimeinfo->offset, mimeinfo->length);
if (msgcontent->content == MIMECONTENT_FILE &&
msgcontent->data.filename != NULL) {
if (msgcontent->tmp == TRUE)
- g_unlink(msgcontent->data.filename);
+ claws_unlink(msgcontent->data.filename);
g_free(msgcontent->data.filename);
}
msgcontent->data.mem = g_strdup(tmp);
if (msgcontent->content == MIMECONTENT_FILE &&
msgcontent->data.filename != NULL) {
if (msgcontent->tmp == TRUE)
- g_unlink(msgcontent->data.filename);
+ claws_unlink(msgcontent->data.filename);
g_free(msgcontent->data.filename);
}
msgcontent->data.mem = g_strdup(tmp);
}
fp = NULL;
#ifdef G_OS_WIN32
- g_unlink(path);
+ claws_unlink(path);
#endif
if (g_rename(tmp_path, path) < 0) {
FILE_OP_ERROR(path, "rename");
if (fprintf(fp, "%s\n", prefix) < 0) {
FILE_OP_ERROR(file, "fprintf");
fclose(fp);
- g_unlink(file);
+ claws_unlink(file);
return -1;
}
}
FILE_OP_ERROR(file, "fwrite");
g_warning("can't write to file: %s\n", file);
fclose(fp);
- g_unlink(file);
+ claws_unlink(file);
return -1;
}
FILE_OP_ERROR(file, "fwrite");
g_warning("can't write to file: %s\n", file);
fclose(fp);
- g_unlink(file);
+ claws_unlink(file);
return -1;
}
if (data[len - 1] != '\r' && data[len - 1] != '\n') {
FILE_OP_ERROR(file, "fputc");
g_warning("can't write to file: %s\n", file);
fclose(fp);
- g_unlink(file);
+ claws_unlink(file);
return -1;
}
}
if (fclose(fp) == EOF) {
FILE_OP_ERROR(file, "fclose");
- g_unlink(file);
+ claws_unlink(file);
return -1;
}
NULL, NULL, NULL},
{"use_networkmanager", "TRUE", &prefs_common.use_networkmanager, P_BOOL,
NULL, NULL, NULL},
+ {"use_shred", "FALSE", &prefs_common.use_shred, P_BOOL,
+ NULL, NULL, NULL},
{NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
};
}
fp = NULL;
#ifdef G_OS_WIN32
- g_unlink(path);
+ claws_unlink(path);
#endif
if (g_rename(tmp_path, path) < 0) {
FILE_OP_ERROR(path, "rename");
return "xdg-open %s";
#endif
}
+
+gboolean prefs_common_get_use_shred(void)
+{
+ return prefs_common.use_shred;
+}
gint print_previewwin_height;
gboolean use_networkmanager;
+ gboolean use_shred;
};
extern PrefsCommon prefs_common;
GtkWidget *spinbtn_iotimeout;
GtkWidget *checkbtn_gtk_can_change_accels;
GtkWidget *checkbtn_askonfilter;
+ GtkWidget *checkbtn_use_shred;
GtkWidget *checkbtn_real_time_sync;
} OtherPage;
GtkWidget *frame_keys;
GtkWidget *vbox_keys;
GtkWidget *checkbtn_gtk_can_change_accels;
- GtkTooltips *gtk_can_change_accels_tooltip;
+ GtkTooltips *tooltips;
GtkWidget *button_keybind;
GtkWidget *label_iotimeout;
GtkWidget *vbox2;
GtkWidget *checkbtn_askonclean;
GtkWidget *checkbtn_askonfilter;
+ GtkWidget *checkbtn_use_shred;
GtkWidget *checkbtn_real_time_sync;
+ gchar *shred_binary = NULL;
vbox1 = gtk_vbox_new (FALSE, VSPACING);
gtk_widget_show (vbox1);
gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
PACK_CHECK_BUTTON(vbox_keys, checkbtn_gtk_can_change_accels,
_("Enable customisable keyboard shortcuts"));
- gtk_can_change_accels_tooltip = gtk_tooltips_new();
- gtk_tooltips_set_tip(GTK_TOOLTIPS(gtk_can_change_accels_tooltip),
+ tooltips = gtk_tooltips_new();
+ gtk_tooltips_set_tip(GTK_TOOLTIPS(tooltips),
checkbtn_gtk_can_change_accels,
_("If checked, you can change the keyboard shortcuts of "
"most of the menu items by focusing on the menu "
PACK_CHECK_BUTTON (vbox2, checkbtn_askonfilter,
_("Ask about account specific filtering rules when "
"filtering manually"));
+ shred_binary = g_find_program_in_path("shred");
+ if (shred_binary) {
+ PACK_CHECK_BUTTON (vbox2, checkbtn_use_shred,
+ _("Use secure file deletion if possible"));
+ g_free(shred_binary);
+ } else {
+ PACK_CHECK_BUTTON (vbox2, checkbtn_use_shred,
+ _("Use secure file deletion if possible\n"
+ "(the 'shred' program is not available)"));
+ gtk_widget_set_sensitive(checkbtn_use_shred, FALSE);
+ }
+ gtk_tooltips_set_tip(GTK_TOOLTIPS(tooltips),
+ checkbtn_use_shred,
+ _("Use the 'shred' program to overwrite files with random data before "
+ "deleting them. This slows down deletion. Be sure to "
+ "read shred's man page for caveats."),
+ NULL);
PACK_CHECK_BUTTON (vbox2, checkbtn_real_time_sync,
_("Synchronise offline folders as soon as possible"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_askonfilter),
prefs_common.ask_apply_per_account_filtering_rules);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_use_shred),
+ prefs_common.use_shred);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_real_time_sync),
prefs_common.real_time_sync);
prefs_other->spinbtn_iotimeout = spinbtn_iotimeout;
prefs_other->checkbtn_gtk_can_change_accels = checkbtn_gtk_can_change_accels;
prefs_other->checkbtn_askonfilter = checkbtn_askonfilter;
+ prefs_other->checkbtn_use_shred = checkbtn_use_shred;
prefs_other->checkbtn_real_time_sync = checkbtn_real_time_sync;
prefs_other->page.widget = vbox1;
prefs_common.ask_apply_per_account_filtering_rules =
gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(page->checkbtn_askonfilter));
+ prefs_common.use_shred =
+ gtk_toggle_button_get_active(
+ GTK_TOGGLE_BUTTON(page->checkbtn_use_shred));
prefs_common.real_time_sync =
gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(page->checkbtn_real_time_sync));
g_warning("prefs_themes_file_remove(): subdir in theme dir skipped: '%s'.\n",
base);
}
- else if (0 != g_unlink(filename)) {
+ else if (0 != claws_unlink(filename)) {
(*status) = g_strdup(filename);
}
g_free(base);
val = procheader_get_one_field(buf,len, fp, hentry);
if (fclose(fp) == EOF) {
FILE_OP_ERROR(file, "fclose");
- g_unlink(file);
+ claws_unlink(file);
g_free(file);
return -1;
}
switch (mimeinfo->content) {
case MIMECONTENT_FILE:
if (mimeinfo->tmp)
- g_unlink(mimeinfo->data.filename);
+ claws_unlink(mimeinfo->data.filename);
g_free(mimeinfo->data.filename);
break;
stat(tmpfilename, &statbuf);
if (mimeinfo->tmp && (mimeinfo->data.filename != NULL))
- g_unlink(mimeinfo->data.filename);
+ claws_unlink(mimeinfo->data.filename);
g_free(mimeinfo->data.filename);
mimeinfo->data.filename = tmpfilename;
mimeinfo->tmp = TRUE;
}
if ((tmp_fp = g_fopen(tmp_file, "rb")) == NULL) {
FILE_OP_ERROR(tmp_file, "fopen");
- g_unlink(tmp_file);
+ claws_unlink(tmp_file);
g_free(tmp_file);
fclose(infp);
return FALSE;
if (tmp_file) {
fclose(tmp_fp);
- g_unlink(tmp_file);
+ claws_unlink(tmp_file);
g_free(tmp_file);
}
} else if (encoding == ENC_QUOTED_PRINTABLE) {
if (mimeinfo->content == MIMECONTENT_FILE) {
if (mimeinfo->tmp && (mimeinfo->data.filename != NULL))
- g_unlink(mimeinfo->data.filename);
+ claws_unlink(mimeinfo->data.filename);
g_free(mimeinfo->data.filename);
} else if (mimeinfo->content == MIMECONTENT_MEM) {
if (mimeinfo->tmp && (mimeinfo->data.mem != NULL))
if (fclose(outfp) == EOF) {
saved_errno = errno;
FILE_OP_ERROR(outfile, "fclose");
- g_unlink(outfile);
+ claws_unlink(outfile);
return -(saved_errno);
}
fclose(tmpfp);
rewind(outfp);
- g_unlink(tmpfile);
+ claws_unlink(tmpfile);
g_free(tmpfile);
if (err == TRUE) {
folder_item_scan(outbox);
if ((num = folder_item_add_msg(outbox, tmp, &flag, TRUE)) < 0) {
g_warning("can't save message\n");
- g_unlink(tmp);
+ claws_unlink(tmp);
return -1;
}
} else {
newsac->nntp_server);
}
}
- g_unlink(tmp);
+ claws_unlink(tmp);
}
g_free(tmp);
}
}
if (tmp_enc_file != NULL) {
- g_unlink(tmp_enc_file);
+ claws_unlink(tmp_enc_file);
free(tmp_enc_file);
tmp_enc_file = NULL;
}
tmpfp = g_fopen(filename, "rb");
textview_show_html(textview, tmpfp, conv);
fclose(tmpfp);
- g_unlink(filename);
+ claws_unlink(filename);
}
g_free(filename);
} else if (!g_ascii_strcasecmp(mimeinfo->subtype, "enriched")) {
tmpfp = g_fopen(filename, "rb");
textview_show_ertf(textview, tmpfp, conv);
fclose(tmpfp);
- g_unlink(filename);
+ claws_unlink(filename);
}
g_free(filename);
#ifndef G_OS_WIN32
g_free(head);
g_free(body);
g_free(msg);
- g_unlink(file);
+ claws_unlink(file);
}
#undef XFACE