commit e15a894c7105210c4cc3b14a8975aa321214e5ce
parent c78b4c3c2c462e2d276c23d0a141ddd2dd39ed60
Author: Oliver Lowe <o@olowe.co>
Date: Wed, 13 Aug 2025 11:13:03 +1000
Just unlink(2), don't shred too
Most mail is going to be stored on a server somewhere, so shredding
here, in most cases, is just shredding some cached file. For cases
where the mail really is just kept locally... don't trust an old
GUI client
Diffstat:
33 files changed, 129 insertions(+), 203 deletions(-)
diff --git a/src/addrbook.c b/src/addrbook.c
@@ -2246,7 +2246,7 @@ void addrbook_delete_book_file(AddressBookFile *book)
book_path = g_strconcat(book->path, G_DIR_SEPARATOR_S,
book->fileName, NULL);
- claws_unlink(book_path);
+ unlink(book_path);
g_free(book_path);
}
diff --git a/src/addressbook.c b/src/addressbook.c
@@ -3989,7 +3989,7 @@ static gboolean migrate_addrbook(const gchar *origdir, const gchar *destdir)
else {
gchar *orig_file = g_strconcat(origdir, G_DIR_SEPARATOR_S,
d, NULL);
- claws_unlink(orig_file);
+ unlink(orig_file);
g_free(orig_file);
}
}
diff --git a/src/addritem.c b/src/addritem.c
@@ -298,7 +298,7 @@ void addritem_person_remove_picture( ItemPerson *person) {
if (is_file_exist(filename)) {
debug_print("removing addressbook picture %s\n",
filename);
- if (claws_unlink(filename) < 0) {
+ if (unlink(filename) < 0) {
FILE_OP_ERROR(filename, "remove");
g_free(filename);
return;
diff --git a/src/addrmerge.c b/src/addrmerge.c
@@ -131,7 +131,7 @@ static void addrmerge_do_merge(struct AddrMergePage *page)
gchar *filename = addritem_person_get_picture(person);
if ((g_strcmp0(person->picture, target->picture) &&
filename && is_file_exist(filename)))
- claws_unlink(filename);
+ unlink(filename);
if (filename)
g_free(filename);
addritem_free_item_person( person );
diff --git a/src/common/file-utils.c b/src/common/file-utils.c
@@ -40,7 +40,6 @@
#include "file-utils.h"
gboolean prefs_common_get_flush_metadata(void);
-gboolean prefs_common_get_use_shred(void);
int safe_fclose(FILE *fp)
{
@@ -53,42 +52,6 @@ int safe_fclose(FILE *fp)
return fclose(fp);
}
-int claws_unlink(const char *filename)
-{
- GStatBuf s;
- static int found_shred = -1;
- static const gchar *args[4];
-
- if (filename == NULL)
- return 0;
-
- if (prefs_common_get_use_shred()) {
- 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) {
- if (g_stat(filename, &s) == 0 && S_ISREG(s.st_mode)) {
- 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));
- if (truncate(filename, 0) < 0)
- g_warning("couldn't truncate: %s", filename);
- }
- }
- }
- }
- return g_unlink(filename);
-}
-
gint file_strip_crs(const gchar *file)
{
FILE *fp = NULL, *outfp = NULL;
@@ -127,7 +90,7 @@ gint file_strip_crs(const gchar *file)
g_free(out);
return 0;
unlinkout:
- claws_unlink(out);
+ unlink(out);
freeout:
g_free(out);
return -1;
@@ -168,7 +131,7 @@ gint append_file(const gchar *src, const gchar *dest, gboolean keep_backup)
g_warning("writing to %s failed", dest);
fclose(dest_fp);
fclose(src_fp);
- claws_unlink(dest);
+ unlink(dest);
return -1;
}
}
@@ -184,7 +147,7 @@ gint append_file(const gchar *src, const gchar *dest, gboolean keep_backup)
}
if (err) {
- claws_unlink(dest);
+ unlink(dest);
return -1;
}
@@ -236,8 +199,8 @@ gint copy_file(const gchar *src, const gchar *dest, gboolean keep_backup)
g_warning("writing to %s failed", dest);
fclose(dest_fp);
fclose(src_fp);
- if (claws_unlink(dest) < 0)
- FILE_OP_ERROR(dest, "claws_unlink");
+ if (unlink(dest) < 0)
+ FILE_OP_ERROR(dest, "unlink");
if (dest_bak) {
if (rename_force(dest_bak, dest) < 0)
FILE_OP_ERROR(dest_bak, "rename");
@@ -258,8 +221,8 @@ gint copy_file(const gchar *src, const gchar *dest, gboolean keep_backup)
}
if (err) {
- if (claws_unlink(dest) < 0)
- FILE_OP_ERROR(dest, "claws_unlink");
+ if (unlink(dest) < 0)
+ FILE_OP_ERROR(dest, "unlink");
if (dest_bak) {
if (rename_force(dest_bak, dest) < 0)
FILE_OP_ERROR(dest_bak, "rename");
@@ -269,8 +232,8 @@ gint copy_file(const gchar *src, const gchar *dest, gboolean keep_backup)
}
if (keep_backup == FALSE && dest_bak)
- if (claws_unlink(dest_bak) < 0)
- FILE_OP_ERROR(dest_bak, "claws_unlink");
+ if (unlink(dest_bak) < 0)
+ FILE_OP_ERROR(dest_bak, "unlink");
g_free(dest_bak);
@@ -293,7 +256,7 @@ gint move_file(const gchar *src, const gchar *dest, gboolean overwrite)
if (copy_file(src, dest, FALSE) < 0) return -1;
- claws_unlink(src);
+ unlink(src);
return 0;
}
@@ -357,7 +320,7 @@ gint copy_file_part(FILE *fp, off_t offset, size_t length, const gchar *dest)
if (err) {
g_warning("writing to %s failed", dest);
- claws_unlink(dest);
+ unlink(dest);
return -1;
}
@@ -417,7 +380,7 @@ gint canonicalize_file(const gchar *src, const gchar *dest)
g_warning("writing to %s failed", dest);
fclose(dest_fp);
fclose(src_fp);
- claws_unlink(dest);
+ unlink(dest);
return -1;
}
}
@@ -438,7 +401,7 @@ gint canonicalize_file(const gchar *src, const gchar *dest)
}
if (err) {
- claws_unlink(dest);
+ unlink(dest);
return -1;
}
@@ -458,7 +421,7 @@ gint canonicalize_file_replace(const gchar *file)
if (move_file(tmp_file, file, TRUE) < 0) {
g_warning("can't replace file: %s", file);
- claws_unlink(tmp_file);
+ unlink(tmp_file);
g_free(tmp_file);
return -1;
}
@@ -491,7 +454,7 @@ gint str_write_to_file(const gchar *str, const gchar *file, gboolean safe)
if (fwrite(str, 1, len, fp) != len) {
FILE_OP_ERROR(file, "fwrite");
fclose(fp);
- claws_unlink(file);
+ unlink(file);
return -1;
}
@@ -503,7 +466,7 @@ gint str_write_to_file(const gchar *str, const gchar *file, gboolean safe)
if (r == EOF) {
FILE_OP_ERROR(file, "fclose");
- claws_unlink(file);
+ unlink(file);
return -1;
}
@@ -658,7 +621,7 @@ gint rename_force(const gchar *oldpath, const gchar *newpath)
return -1;
}
if (is_file_exist(newpath)) {
- if (claws_unlink(newpath) < 0)
+ if (unlink(newpath) < 0)
FILE_OP_ERROR(newpath, "unlink");
}
#endif
@@ -762,7 +725,7 @@ FILE *my_tmpfile(void)
return tmpfile();
#ifndef G_OS_WIN32
- claws_unlink(fname);
+ unlink(fname);
/* verify that we can write in the file after unlinking */
if (write(fd, buf, 1) < 0) {
diff --git a/src/common/file-utils.h b/src/common/file-utils.h
@@ -27,7 +27,6 @@
#include <glib.h>
int safe_fclose(FILE *fp);
-int claws_unlink (const char *filename);
gint file_strip_crs (const gchar *file);
gint append_file (const gchar *src,
diff --git a/src/common/log.c b/src/common/log.c
@@ -111,7 +111,7 @@ void set_log_file(LogInstance instance, const gchar *filename)
gchar *backupname;
backupname = g_strconcat(fullname, ".bak", NULL);
- claws_unlink(backupname);
+ unlink(backupname);
if (g_rename(fullname, backupname) < 0)
FILE_OP_ERROR(fullname, "rename");
g_free(backupname);
diff --git a/src/common/prefs.c b/src/common/prefs.c
@@ -164,7 +164,7 @@ gint prefs_file_close(PrefFile *pfile)
if (safe_fclose(fp) == EOF) {
FILE_OP_ERROR(tmppath, "fclose");
- claws_unlink(tmppath);
+ unlink(tmppath);
g_free(path);
g_free(tmppath);
return -1;
@@ -173,11 +173,11 @@ gint prefs_file_close(PrefFile *pfile)
if (is_file_exist(path)) {
bakpath = g_strconcat(path, ".bak", NULL);
#ifdef G_OS_WIN32
- claws_unlink(bakpath);
+ unlink(bakpath);
#endif
if (g_rename(path, bakpath) < 0) {
FILE_OP_ERROR(path, "rename");
- claws_unlink(tmppath);
+ unlink(tmppath);
g_free(path);
g_free(tmppath);
g_free(bakpath);
@@ -186,11 +186,11 @@ gint prefs_file_close(PrefFile *pfile)
}
#ifdef G_OS_WIN32
- claws_unlink(path);
+ unlink(path);
#endif
if (g_rename(tmppath, path) < 0) {
FILE_OP_ERROR(tmppath, "rename");
- claws_unlink(tmppath);
+ unlink(tmppath);
g_free(path);
g_free(tmppath);
g_free(bakpath);
@@ -221,7 +221,7 @@ gint prefs_file_close_revert(PrefFile *pfile)
tmppath = g_strconcat(pfile->path, ".tmp", NULL);
fclose(pfile->fp);
if (pfile->writing) {
- if (claws_unlink(tmppath) < 0) FILE_OP_ERROR(tmppath, "unlink");
+ if (unlink(tmppath) < 0) FILE_OP_ERROR(tmppath, "unlink");
g_free(tmppath);
}
g_free(pfile->path);
diff --git a/src/common/ssl_certificate.c b/src/common/ssl_certificate.c
@@ -407,10 +407,10 @@ void ssl_certificate_delete_from_disk(SSLCertificate *cert)
gchar *file;
buf = g_strdup_printf("%d", cert->port);
file = get_certificate_path(cert->host, buf, cert->fingerprint);
- claws_unlink (file);
+ unlink (file);
g_free(file);
file = get_certificate_chain_path(cert->host, buf, cert->fingerprint);
- claws_unlink (file);
+ unlink (file);
g_free(file);
g_free(buf);
}
diff --git a/src/common/template.c b/src/common/template.c
@@ -205,7 +205,7 @@ if (!(func)) \
{ \
g_warning("failed to write template to file"); \
if (fp) fclose(fp); \
- if (new) claws_unlink(new); \
+ if (new) unlink(new); \
g_free(new); \
g_free(filename); \
return; \
@@ -216,7 +216,7 @@ if (!(func)) \
if (!(func)) \
{ \
g_warning("failed to write template to file"); \
- if (new) claws_unlink(new); \
+ if (new) unlink(new); \
g_free(new); \
g_free(filename); \
return; \
@@ -302,7 +302,7 @@ static void template_write_config(GSList *tmpl_list)
itos(tmpl_num), NULL);
if (is_file_exist(filename)) {
debug_print("removing old template %d\n", tmpl_num);
- claws_unlink(filename);
+ unlink(filename);
g_free(filename);
} else {
g_free(filename);
diff --git a/src/common/utils.c b/src/common/utils.c
@@ -2135,7 +2135,7 @@ gint remove_all_files(const gchar *dir)
while ((file_name = g_dir_read_name(dp)) != NULL) {
tmp = g_strconcat(dir, G_DIR_SEPARATOR_S, file_name, NULL);
- if (claws_unlink(tmp) < 0)
+ if (unlink(tmp) < 0)
FILE_OP_ERROR(tmp, "unlink");
g_free(tmp);
}
@@ -2161,7 +2161,7 @@ gint remove_numbered_files(const gchar *dir, guint first, guint last)
g_free(filename);
filename = g_strdup_printf("%s%s.%u", dir, G_DIR_SEPARATOR_S, first);
}
- if (claws_unlink(filename) < 0) {
+ if (unlink(filename) < 0) {
FILE_OP_ERROR(filename, "unlink");
g_free(filename);
return -1;
@@ -2189,13 +2189,13 @@ gint remove_numbered_files(const gchar *dir, guint first, guint last)
if (file_no > 0 && first <= file_no && file_no <= last) {
if (is_dir_exist(dir_name)) {
gchar *dot_file = g_strdup_printf(".%s", dir_name);
- if (is_file_exist(dot_file) && claws_unlink(dot_file) < 0) {
+ if (is_file_exist(dot_file) && unlink(dot_file) < 0) {
FILE_OP_ERROR(dot_file, "unlink");
}
g_free(dot_file);
continue;
}
- if (claws_unlink(dir_name) < 0)
+ if (unlink(dir_name) < 0)
FILE_OP_ERROR(dir_name, "unlink");
}
}
@@ -2256,13 +2256,13 @@ gint remove_numbered_files_not_in_list(const gchar *dir, GSList *numberlist)
debug_print("removing unwanted file %d from %s\n", file_no, dir);
if (is_dir_exist(dir_name)) {
gchar *dot_file = g_strdup_printf(".%s", dir_name);
- if (is_file_exist(dot_file) && claws_unlink(dot_file) < 0) {
+ if (is_file_exist(dot_file) && unlink(dot_file) < 0) {
FILE_OP_ERROR(dot_file, "unlink");
}
g_free(dot_file);
continue;
}
- if (claws_unlink(dir_name) < 0)
+ if (unlink(dir_name) < 0)
FILE_OP_ERROR(dir_name, "unlink");
}
}
@@ -2300,7 +2300,7 @@ gint remove_dir_recursive(const gchar *dir)
}
if (!S_ISDIR(s.st_mode)) {
- if (claws_unlink(dir) < 0) {
+ if (unlink(dir) < 0) {
FILE_OP_ERROR(dir, "unlink");
return -(errno);
}
@@ -2346,7 +2346,7 @@ gint remove_dir_recursive(const gchar *dir)
return ret;
}
} else {
- if (claws_unlink(dir_name) < 0)
+ if (unlink(dir_name) < 0)
FILE_OP_ERROR(dir_name, "unlink");
}
}
diff --git a/src/compose.c b/src/compose.c
@@ -5355,7 +5355,7 @@ gint compose_send(Compose *compose)
g_free(msgpath);
} else {
val = procmsg_send_message_queue_with_lock(msgpath, &errstr, folder, msgnum, &queued_removed);
- claws_unlink(msgpath);
+ unlink(msgpath);
g_free(msgpath);
}
if (!discard_window) {
@@ -5956,7 +5956,7 @@ static gint compose_write_to_file(Compose *compose, FILE *fp, gint action, gbool
outbox = folder_get_default_outbox();
procmsg_save_to_outbox(outbox, tmp_enc_file);
- claws_unlink(tmp_enc_file);
+ unlink(tmp_enc_file);
} else {
g_warning("can't open file '%s'", tmp_enc_file);
}
@@ -6013,7 +6013,7 @@ static gint compose_write_body_to_file(Compose *compose, const gchar *file)
g_free(tmp);
if (!chars) {
fclose(fp);
- claws_unlink(file);
+ unlink(file);
return -1;
}
/* write body */
@@ -6022,7 +6022,7 @@ static gint compose_write_body_to_file(Compose *compose, const gchar *file)
FILE_OP_ERROR(file, "fwrite");
g_free(chars);
fclose(fp);
- claws_unlink(file);
+ unlink(file);
return -1;
}
@@ -6030,7 +6030,7 @@ static gint compose_write_body_to_file(Compose *compose, const gchar *file)
if (safe_fclose(fp) == EOF) {
FILE_OP_ERROR(file, "fclose");
- claws_unlink(file);
+ unlink(file);
return -1;
}
return 0;
@@ -6222,7 +6222,7 @@ static ComposeQueueResult compose_queue_sub(Compose *compose, gint *msgnum, Fold
if (compose->use_encryption) {
if (!compose_warn_encryption(compose)) {
fclose(fp);
- claws_unlink(tmp);
+ unlink(tmp);
g_free(tmp);
return COMPOSE_QUEUE_ERROR_NO_MSG;
}
@@ -6247,7 +6247,7 @@ static ComposeQueueResult compose_queue_sub(Compose *compose, gint *msgnum, Fold
if (err == TRUE)
g_warning("failed to write queue message");
fclose(fp);
- claws_unlink(tmp);
+ unlink(tmp);
g_free(tmp);
return COMPOSE_QUEUE_ERROR_NO_ENCRYPTION_KEY;
}
@@ -6300,7 +6300,7 @@ static ComposeQueueResult compose_queue_sub(Compose *compose, gint *msgnum, Fold
if (compose->redirect_filename != NULL) {
if (compose_redirect_write_to_file(compose, fp) < 0) {
fclose(fp);
- claws_unlink(tmp);
+ unlink(tmp);
g_free(tmp);
return COMPOSE_QUEUE_ERROR_WITH_ERRNO;
}
@@ -6308,7 +6308,7 @@ static ComposeQueueResult compose_queue_sub(Compose *compose, gint *msgnum, Fold
gint result = 0;
if ((result = compose_write_to_file(compose, fp, COMPOSE_WRITE_FOR_SEND, TRUE)) < 0) {
fclose(fp);
- claws_unlink(tmp);
+ unlink(tmp);
g_free(tmp);
return result;
}
@@ -6316,13 +6316,13 @@ static ComposeQueueResult compose_queue_sub(Compose *compose, gint *msgnum, Fold
if (err == TRUE) {
g_warning("failed to write queue message");
fclose(fp);
- claws_unlink(tmp);
+ unlink(tmp);
g_free(tmp);
return COMPOSE_QUEUE_ERROR_WITH_ERRNO;
}
if (safe_fclose(fp) == EOF) {
FILE_OP_ERROR(tmp, "fclose");
- claws_unlink(tmp);
+ unlink(tmp);
g_free(tmp);
return COMPOSE_QUEUE_ERROR_WITH_ERRNO;
}
@@ -6334,20 +6334,20 @@ static ComposeQueueResult compose_queue_sub(Compose *compose, gint *msgnum, Fold
}
if (!queue) {
g_warning("can't find queue folder");
- claws_unlink(tmp);
+ unlink(tmp);
g_free(tmp);
return COMPOSE_QUEUE_ERROR_NO_MSG;
}
folder_item_scan(queue);
if ((num = folder_item_add_msg(queue, tmp, NULL, FALSE)) < 0) {
g_warning("can't queue the message");
- claws_unlink(tmp);
+ unlink(tmp);
g_free(tmp);
return COMPOSE_QUEUE_ERROR_NO_MSG;
}
if (msgpath == NULL) {
- claws_unlink(tmp);
+ unlink(tmp);
g_free(tmp);
} else
*msgpath = tmp;
@@ -9655,7 +9655,7 @@ static void compose_ext_editor_closed_cb(GPid pid, gint exit_status, gpointer da
if (compose_can_autosave(compose))
compose_draft((gpointer)compose, COMPOSE_AUTO_SAVE);
- if (claws_unlink(compose->exteditor_file) < 0)
+ if (unlink(compose->exteditor_file) < 0)
FILE_OP_ERROR(compose->exteditor_file, "unlink");
gtk_text_buffer_get_start_iter(buffer, &iter);
@@ -10328,7 +10328,7 @@ gboolean compose_draft (gpointer data, guint action)
}
if (msgnum < 0) {
warn_err:
- claws_unlink(tmp);
+ unlink(tmp);
g_free(tmp);
if (action != COMPOSE_AUTO_SAVE) {
if (action != COMPOSE_DRAFT_FOR_EXIT)
@@ -10458,7 +10458,7 @@ void compose_clear_exit_drafts(void)
gchar *filepath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
DRAFTED_AT_EXIT, NULL);
if (is_file_exist(filepath))
- claws_unlink(filepath);
+ unlink(filepath);
g_free(filepath);
}
@@ -10890,7 +10890,7 @@ int attach_image(Compose *compose, GtkSelectionData *data, const gchar *subtype)
if (fwrite(contents, 1, len, fp) != len) {
FILE_OP_ERROR(file, "fwrite");
fclose(fp);
- if (claws_unlink(file) < 0)
+ if (unlink(file) < 0)
FILE_OP_ERROR(file, "unlink");
g_free(file);
return -1;
@@ -10900,7 +10900,7 @@ int attach_image(Compose *compose, GtkSelectionData *data, const gchar *subtype)
if (r == EOF) {
FILE_OP_ERROR(file, "fclose");
- if (claws_unlink(file) < 0)
+ if (unlink(file) < 0)
FILE_OP_ERROR(file, "unlink");
g_free(file);
return -1;
@@ -11649,7 +11649,7 @@ static void compose_insert_drag_received_cb (GtkWidget *widget,
str_write_to_file(tmpdata, tmpfile, TRUE);
g_free(tmpdata);
compose_insert_file(compose, tmpfile);
- claws_unlink(tmpfile);
+ unlink(tmpfile);
g_free(tmpfile);
gtk_drag_finish(drag_context, TRUE, FALSE, time);
compose_beautify_paragraph(compose, NULL, compose->autowrap);
diff --git a/src/editaddress.c b/src/editaddress.c
@@ -1691,7 +1691,7 @@ static gboolean addressbook_edit_person_close( gboolean cancelled )
else
name = g_strconcat( get_rc_dir(), G_DIR_SEPARATOR_S, ADDRBOOK_DIR, G_DIR_SEPARATOR_S,
current_person->picture, ".png", NULL );
- claws_unlink(name);
+ unlink(name);
g_free(name);
}
name = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_first), 0, -1 );
diff --git a/src/etpan/imap-thread.c b/src/etpan/imap-thread.c
@@ -2664,8 +2664,8 @@ static void fetch_content_run(struct etpan_thread_op * op)
close:
close(fd);
unlink:
- if (claws_unlink(param->filename) < 0)
- FILE_OP_ERROR(param->filename, "claws_unlink");
+ if (unlink(param->filename) < 0)
+ FILE_OP_ERROR(param->filename, "unlink");
free:
/* mmap_string_unref is a simple free in libetpan
diff --git a/src/folder.c b/src/folder.c
@@ -446,7 +446,7 @@ void folder_item_remove(FolderItem *item)
if (tags_file) {
gchar *tags_dir;
- claws_unlink(tags_file);
+ unlink(tags_file);
tags_dir = g_path_get_dirname(tags_file);
if (tags_dir)
@@ -3247,7 +3247,7 @@ gint folder_item_add_msgs(FolderItem *dest, GSList *file_list,
lastnum = num;
if (num >= 0 && remove_source) {
- if (claws_unlink(fileinfo->file) < 0)
+ if (unlink(fileinfo->file) < 0)
FILE_OP_ERROR(fileinfo->file, "unlink");
}
@@ -3989,7 +3989,7 @@ void folder_item_discard_cache(FolderItem *item)
cache = folder_item_get_cache_file(item);
if (is_file_exist(cache))
- claws_unlink(cache);
+ unlink(cache);
g_free(cache);
}
diff --git a/src/imap.c b/src/imap.c
@@ -1516,7 +1516,7 @@ static void imap_remove_cached_msg(Folder *folder, FolderItem *item, MsgInfo *ms
cm_return_if_fail(filename != NULL);
if (is_file_exist(filename)) {
- claws_unlink(filename);
+ unlink(filename);
}
g_free(filename);
}
@@ -1652,7 +1652,7 @@ static gchar *imap_fetch_msg_full(Folder *folder, FolderItem *item, gint uid,
path = folder_item_get_path(item);
if (!is_dir_exist(path)) {
if(is_file_exist(path))
- claws_unlink(path);
+ unlink(path);
make_dir_hier(path);
}
g_free(path);
@@ -3289,7 +3289,7 @@ static FolderItem *imap_create_folder(Folder *folder, FolderItem *parent,
if (to_number(name) > 0) {
gchar *cached_msg = imap_get_cached_filename(parent, to_number(name));
if (is_file_exist(cached_msg)) {
- if (claws_unlink(cached_msg) != 0) {
+ if (unlink(cached_msg) != 0) {
g_free(cached_msg);
return NULL;
}
@@ -4742,7 +4742,7 @@ gint imap_get_num_list(Folder *folder, FolderItem *_item, GSList **msgnum_list,
path = folder_item_get_path(_item);
if (!is_dir_exist(path)) {
if(is_file_exist(path))
- claws_unlink(path);
+ unlink(path);
make_dir_hier(path);
}
g_free(path);
diff --git a/src/inc.c b/src/inc.c
@@ -1191,7 +1191,7 @@ static gint inc_drop_message(Pop3Session *session, const gchar *file)
} else
inbox = folder_get_default_inbox();
if (!inbox) {
- claws_unlink(file);
+ unlink(file);
return -1;
}
@@ -1201,7 +1201,7 @@ static gint inc_drop_message(Pop3Session *session, const gchar *file)
/* add msg file to drop folder */
if ((msgnum = folder_item_add_msg(
dropfolder, file, NULL, TRUE)) < 0) {
- claws_unlink(file);
+ unlink(file);
return -1;
}
@@ -1434,7 +1434,7 @@ static gint get_spool(FolderItem *dest, const gchar *mbox, PrefsAccount *account
msgs = proc_mbox(dest, tmp_mbox, account->filter_on_recv, account);
- claws_unlink(tmp_mbox);
+ unlink(tmp_mbox);
if (msgs >= 0) empty_mbox(mbox);
unlock_mbox(mbox, lockfd, LOCK_FLOCK);
diff --git a/src/main.c b/src/main.c
@@ -1796,13 +1796,13 @@ static gint prohibit_duplicate_launch(int *argc, char ***argv)
}
#endif
- claws_unlink(path);
+ unlink(path);
debug_print("Opening socket %s\n", path);
ret = fd_open_unix(path);
#if HAVE_FLOCK
flock(lock_fd, LOCK_UN);
close(lock_fd);
- claws_unlink(socket_lock);
+ unlink(socket_lock);
g_free(socket_lock);
#endif
return ret;
@@ -1991,8 +1991,8 @@ static gint lock_socket_remove(void)
#ifdef G_OS_UNIX
filename = claws_get_socket_name();
dirname = g_path_get_dirname(filename);
- if (claws_unlink(filename) < 0)
- FILE_OP_ERROR(filename, "claws_unlink");
+ if (unlink(filename) < 0)
+ FILE_OP_ERROR(filename, "unlink");
g_rmdir(dirname);
g_free(dirname);
#endif
diff --git a/src/mbox.c b/src/mbox.c
@@ -56,7 +56,7 @@
g_warning("can't write to temporary file"); \
fclose(tmp_fp); \
fclose(mbox_fp); \
- claws_unlink(tmp_file); \
+ unlink(tmp_file); \
g_free(tmp_file); \
return -1; \
} \
@@ -215,7 +215,7 @@ gint proc_mbox(FolderItem *dest, const gchar *mbox, gboolean apply_filter,
g_warning("malformed mbox: %s: message %d is empty", mbox, msgs);
fclose(tmp_fp);
fclose(mbox_fp);
- claws_unlink(tmp_file);
+ unlink(tmp_file);
return -1;
}
@@ -223,7 +223,7 @@ gint proc_mbox(FolderItem *dest, const gchar *mbox, gboolean apply_filter,
FILE_OP_ERROR(tmp_file, "fclose");
g_warning("can't write to temporary file");
fclose(mbox_fp);
- claws_unlink(tmp_file);
+ unlink(tmp_file);
g_free(tmp_file);
return -1;
}
@@ -231,7 +231,7 @@ gint proc_mbox(FolderItem *dest, const gchar *mbox, gboolean apply_filter,
if (apply_filter) {
if ((msgnum = folder_item_add_msg(dropfolder, tmp_file, NULL, TRUE)) < 0) {
fclose(mbox_fp);
- claws_unlink(tmp_file);
+ unlink(tmp_file);
g_free(tmp_file);
return -1;
}
@@ -335,7 +335,7 @@ gint lock_mbox(const gchar *base, LockType type)
FILE_OP_ERROR(lockfile, "link");
if (retry >= 5) {
g_warning("can't create '%s'", lockfile);
- claws_unlink(lockfile);
+ unlink(lockfile);
g_free(locklink);
g_free(lockfile);
return -1;
@@ -345,7 +345,7 @@ gint lock_mbox(const gchar *base, LockType type)
retry++;
sleep(5);
}
- claws_unlink(lockfile);
+ unlink(lockfile);
g_free(locklink);
g_free(lockfile);
} else if (type == LOCK_FLOCK) {
@@ -412,7 +412,7 @@ gint unlock_mbox(const gchar *base, gint fd, LockType type)
gchar *lockfile;
lockfile = g_strconcat(base, ".lock", NULL);
- if (claws_unlink(lockfile) < 0) {
+ if (unlink(lockfile) < 0) {
FILE_OP_ERROR(lockfile, "unlink");
g_free(lockfile);
return -1;
@@ -490,7 +490,7 @@ gint copy_mbox(gint srcfd, const gchar *dest)
if (fwrite(buf, 1, n_read, dest_fp) < n_read) {
g_warning("writing to %s failed", dest);
fclose(dest_fp);
- claws_unlink(dest);
+ unlink(dest);
return -1;
}
}
@@ -507,7 +507,7 @@ gint copy_mbox(gint srcfd, const gchar *dest)
}
if (err) {
- claws_unlink(dest);
+ unlink(dest);
return -1;
}
diff --git a/src/messageview.c b/src/messageview.c
@@ -1037,7 +1037,7 @@ static gint disposition_notification_send(MsgInfo *msginfo)
if (safe_fclose(fp) == EOF) {
FILE_OP_ERROR(tmp, "fclose");
- claws_unlink(tmp);
+ unlink(tmp);
return -1;
}
@@ -1046,13 +1046,13 @@ static gint disposition_notification_send(MsgInfo *msginfo)
if (!queue) queue = folder_get_default_queue();
if (!queue) {
g_warning("can't find queue folder");
- claws_unlink(tmp);
+ 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");
- claws_unlink(tmp);
+ unlink(tmp);
return -1;
}
@@ -1074,7 +1074,7 @@ static gint disposition_notification_send(MsgInfo *msginfo)
FILE_ERROR:
fclose(fp);
- claws_unlink(tmp);
+ unlink(tmp);
return -1;
}
diff --git a/src/mh.c b/src/mh.c
@@ -641,7 +641,7 @@ static gint mh_remove_msg(Folder *folder, FolderItem *item, gint num)
need_scan = mh_scan_required(folder, item);
last_mtime = item->mtime;
- if (claws_unlink(file) < 0) {
+ if (unlink(file) < 0) {
FILE_OP_ERROR(file, "unlink");
g_free(file);
return -1;
@@ -694,7 +694,7 @@ static gint mh_remove_msgs(Folder *folder, FolderItem *item,
if (file == NULL)
continue;
- if (claws_unlink(file) < 0) {
+ if (unlink(file) < 0) {
g_free(file);
continue;
}
diff --git a/src/msgcache.c b/src/msgcache.c
@@ -1158,7 +1158,7 @@ gint msgcache_write(const gchar *cache_file, const gchar *mark_file, const gchar
g_warning("failed to write charset");
if (write_fps.cache_fp)
fclose(write_fps.cache_fp);
- claws_unlink(new_cache);
+ unlink(new_cache);
g_free(new_cache);
g_free(new_mark);
g_free(new_tags);
@@ -1171,7 +1171,7 @@ gint msgcache_write(const gchar *cache_file, const gchar *mark_file, const gchar
if (write_fps.mark_fp == NULL) {
if (write_fps.cache_fp)
fclose(write_fps.cache_fp);
- claws_unlink(new_cache);
+ unlink(new_cache);
g_free(new_cache);
g_free(new_mark);
g_free(new_tags);
@@ -1189,8 +1189,8 @@ gint msgcache_write(const gchar *cache_file, const gchar *mark_file, const gchar
fclose(write_fps.cache_fp);
if (write_fps.mark_fp)
fclose(write_fps.mark_fp);
- claws_unlink(new_cache);
- claws_unlink(new_mark);
+ unlink(new_cache);
+ unlink(new_mark);
g_free(new_cache);
g_free(new_mark);
g_free(new_tags);
@@ -1228,9 +1228,9 @@ gint msgcache_write(const gchar *cache_file, const gchar *mark_file, const gchar
if (write_fps.error != 0) {
/* in case of error, forget all */
- claws_unlink(new_cache);
- claws_unlink(new_mark);
- claws_unlink(new_tags);
+ unlink(new_cache);
+ unlink(new_mark);
+ unlink(new_tags);
g_free(new_cache);
g_free(new_mark);
g_free(new_tags);
diff --git a/src/news.c b/src/news.c
@@ -213,7 +213,7 @@ static int news_remove_msg (Folder *folder,
filename = g_strconcat(path, G_DIR_SEPARATOR_S, itos(msgnum), NULL);
g_free(path);
- claws_unlink(filename);
+ unlink(filename);
g_free(filename);
return 0;
}
@@ -551,7 +551,7 @@ static void news_remove_cached_msg(Folder *folder, FolderItem *item, MsgInfo *ms
g_free(path);
if (is_file_exist(filename)) {
- claws_unlink(filename);
+ unlink(filename);
}
g_free(filename);
}
@@ -774,7 +774,7 @@ void news_remove_group_list_cache(Folder *folder)
g_free(path);
if (is_file_exist(filename)) {
- if (claws_unlink(filename) < 0)
+ if (unlink(filename) < 0)
FILE_OP_ERROR(filename, "remove");
}
g_free(filename);
@@ -977,20 +977,20 @@ gint news_cancel_article(Folder * folder, MsgInfo * msginfo)
date) < 0) {
FILE_OP_ERROR(tmp, "fprintf");
fclose(tmpfp);
- claws_unlink(tmp);
+ unlink(tmp);
g_free(tmp);
return -1;
}
if (safe_fclose(tmpfp) == EOF) {
FILE_OP_ERROR(tmp, "fclose");
- claws_unlink(tmp);
+ unlink(tmp);
g_free(tmp);
return -1;
}
news_post(folder, tmp);
- claws_unlink(tmp);
+ unlink(tmp);
g_free(tmp);
diff --git a/src/pop.c b/src/pop.c
@@ -811,7 +811,7 @@ gint pop3_write_uidl_list(Pop3Session *session)
}
fp = NULL;
#ifdef G_OS_WIN32
- claws_unlink(path);
+ unlink(path);
#endif
if (g_rename(tmp_path, path) < 0) {
FILE_OP_ERROR(path, "rename");
@@ -850,7 +850,7 @@ static gint pop3_write_msg_to_file(const gchar *file, const gchar *data,
if (fprintf(fp, "%s\n", prefix) < 0) {
FILE_OP_ERROR(file, "fprintf");
fclose(fp);
- claws_unlink(file);
+ unlink(file);
return -1;
}
}
@@ -866,7 +866,7 @@ static gint pop3_write_msg_to_file(const gchar *file, const gchar *data,
FILE_OP_ERROR(file, "fwrite");
g_warning("can't write to file: %s", file);
fclose(fp);
- claws_unlink(file);
+ unlink(file);
return -1;
}
@@ -892,7 +892,7 @@ static gint pop3_write_msg_to_file(const gchar *file, const gchar *data,
FILE_OP_ERROR(file, "fwrite");
g_warning("can't write to file: %s", file);
fclose(fp);
- claws_unlink(file);
+ unlink(file);
return -1;
}
if (data[len - 1] != '\r' && data[len - 1] != '\n') {
@@ -900,14 +900,14 @@ static gint pop3_write_msg_to_file(const gchar *file, const gchar *data,
FILE_OP_ERROR(file, "fputc");
g_warning("can't write to file: %s", file);
fclose(fp);
- claws_unlink(file);
+ unlink(file);
return -1;
}
}
if (safe_fclose(fp) == EOF) {
FILE_OP_ERROR(file, "fclose");
- claws_unlink(file);
+ unlink(file);
return -1;
}
diff --git a/src/prefs_common.c b/src/prefs_common.c
@@ -1155,8 +1155,6 @@ static PrefParam param[] = {
NULL, NULL, NULL},
{"print_previewwin_height", "-1", &prefs_common.print_previewwin_height, P_INT,
NULL, NULL, NULL},
- {"use_shred", "FALSE", &prefs_common.use_shred, P_BOOL,
- NULL, NULL, NULL},
{"two_line_vertical", "TRUE", &prefs_common.two_line_vert,
P_BOOL, NULL, NULL, NULL },
@@ -1349,7 +1347,7 @@ static void prefs_common_save_history_to_dir(const gchar *dirname, const gchar *
}
fp = NULL;
#ifdef G_OS_WIN32
- claws_unlink(path);
+ unlink(path);
#endif
if (g_rename(tmp_path, path) < 0) {
FILE_OP_ERROR(path, "rename");
@@ -1636,11 +1634,6 @@ const gchar *prefs_common_get_ext_editor_cmd(void)
#endif /* 0 */
}
-gboolean prefs_common_get_use_shred(void)
-{
- return prefs_common.use_shred;
-}
-
gboolean prefs_common_get_flush_metadata (void)
{
return prefs_common.flush_metadata;
diff --git a/src/prefs_common.h b/src/prefs_common.h
@@ -566,7 +566,6 @@ struct _PrefsCommon
gint print_previewwin_width;
gint print_previewwin_height;
- gboolean use_shred;
gboolean two_line_vert;
gboolean inherit_folder_props;
gboolean flush_metadata;
diff --git a/src/prefs_other.c b/src/prefs_other.c
@@ -63,7 +63,6 @@ typedef struct _OtherPage
GtkWidget *spinbtn_iotimeout;
GtkWidget *checkbtn_gtk_enable_accels;
GtkWidget *checkbtn_askonfilter;
- GtkWidget *checkbtn_use_shred;
GtkWidget *checkbtn_real_time_sync;
GtkWidget *entry_attach_save_chmod;
GtkWidget *flush_metadata_faster_radiobtn;
@@ -365,7 +364,6 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
GtkWidget *checkbtn_transhdr;
GtkWidget *checkbtn_askonclean;
GtkWidget *checkbtn_askonfilter;
- GtkWidget *checkbtn_use_shred;
GtkWidget *checkbtn_real_time_sync;
GtkWidget *label_attach_save_chmod;
GtkWidget *entry_attach_save_chmod;
@@ -381,8 +379,6 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
GtkWidget *checkbtn_use_passphrase;
GtkWidget *button_change_passphrase;
- gchar *shred_binary = NULL;
-
vbox1 = gtk_box_new(GTK_ORIENTATION_VERTICAL, VSPACING);
gtk_widget_show (vbox1);
gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
@@ -489,24 +485,6 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
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);
- }
- CLAWS_SET_TIP(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"));
- PACK_CHECK_BUTTON (vbox2, checkbtn_real_time_sync,
- _("Synchronise offline folders as soon as possible"));
-
hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
gtk_widget_show(hbox1);
@@ -576,8 +554,6 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
prefs_common.trans_hdr);
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);
@@ -597,7 +573,6 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
prefs_other->checkbtn_transhdr = checkbtn_transhdr;
prefs_other->checkbtn_gtk_enable_accels = checkbtn_gtk_enable_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->entry_attach_save_chmod = entry_attach_save_chmod;
prefs_other->flush_metadata_safer_radiobtn = flush_metadata_safer_radiobtn;
@@ -636,9 +611,6 @@ static void prefs_other_save(PrefsPage *_page)
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));
diff --git a/src/prefs_themes.c b/src/prefs_themes.c
@@ -249,7 +249,7 @@ static void prefs_themes_file_remove(const gchar *filename, gpointer data)
g_warning("prefs_themes_file_remove(): subdir in theme dir skipped: '%s'",
base);
}
- else if (0 != claws_unlink(filename)) {
+ else if (0 != unlink(filename)) {
(*status) = g_strdup(filename);
}
g_free(base);
diff --git a/src/procheader.c b/src/procheader.c
@@ -1283,7 +1283,7 @@ gint procheader_get_header_from_msginfo(MsgInfo *msginfo, gchar **buf, gchar *he
if (fclose(fp) == EOF) {
FILE_OP_ERROR(file, "fclose");
- claws_unlink(file);
+ unlink(file);
g_free(file);
g_free(*buf);
*buf = NULL;
diff --git a/src/procmime.c b/src/procmime.c
@@ -120,7 +120,7 @@ static gboolean free_func(GNode *node, gpointer data)
switch (mimeinfo->content) {
case MIMECONTENT_FILE:
if (mimeinfo->tmp)
- claws_unlink(mimeinfo->data.filename);
+ unlink(mimeinfo->data.filename);
g_free(mimeinfo->data.filename);
break;
@@ -497,7 +497,7 @@ gboolean procmime_decode_content(MimeInfo *mimeinfo)
}
if (mimeinfo->tmp)
- claws_unlink(mimeinfo->data.filename);
+ unlink(mimeinfo->data.filename);
g_free(mimeinfo->data.filename);
mimeinfo->data.filename = tmpfilename;
mimeinfo->tmp = TRUE;
@@ -572,7 +572,7 @@ gboolean procmime_encode_content(MimeInfo *mimeinfo, EncodingType encoding)
}
if ((tmp_fp = g_fopen(tmp_file, "rb")) == NULL) {
FILE_OP_ERROR(tmp_file, "g_fopen");
- claws_unlink(tmp_file);
+ unlink(tmp_file);
g_free(tmp_file);
g_free(tmpfilename);
fclose(infp);
@@ -614,7 +614,7 @@ gboolean procmime_encode_content(MimeInfo *mimeinfo, EncodingType encoding)
if (tmp_file) {
fclose(tmp_fp);
- claws_unlink(tmp_file);
+ unlink(tmp_file);
g_free(tmp_file);
}
} else if (encoding == ENC_QUOTED_PRINTABLE) {
@@ -657,7 +657,7 @@ gboolean procmime_encode_content(MimeInfo *mimeinfo, EncodingType encoding)
if (mimeinfo->content == MIMECONTENT_FILE) {
if (mimeinfo->tmp && (mimeinfo->data.filename != NULL))
- claws_unlink(mimeinfo->data.filename);
+ unlink(mimeinfo->data.filename);
g_free(mimeinfo->data.filename);
} else if (mimeinfo->content == MIMECONTENT_MEM) {
if (mimeinfo->tmp && (mimeinfo->data.mem != NULL))
@@ -745,8 +745,8 @@ gint procmime_get_part(const gchar *outfile, MimeInfo *mimeinfo)
if (fclose(outfp) == EOF) {
saved_errno = errno;
FILE_OP_ERROR(outfile, "fclose");
- if (claws_unlink(outfile) < 0)
- FILE_OP_ERROR(outfile, "claws_unlink");
+ if (unlink(outfile) < 0)
+ FILE_OP_ERROR(outfile, "unlink");
return -(saved_errno);
}
diff --git a/src/procmsg.c b/src/procmsg.c
@@ -1182,7 +1182,7 @@ gint procmsg_save_to_outbox(FolderItem *outbox, const gchar *file)
_("Select the folder where you want to save the sent message"));
if (outbox == NULL) {
g_warning("not saving sent message");
- claws_unlink(tmp);
+ unlink(tmp);
return -1;
}
}
@@ -1190,7 +1190,7 @@ gint procmsg_save_to_outbox(FolderItem *outbox, const gchar *file)
g_warning("not saving sent message");
outbox_path = folder_item_get_path(outbox);
alertpanel_warning(_("Could not save sent message to %s."), outbox_path);
- claws_unlink(tmp);
+ unlink(tmp);
g_free(outbox_path);
return -1;
}
@@ -1752,7 +1752,7 @@ send_mail:
newsac->nntp_server);
}
}
- claws_unlink(tmp);
+ unlink(tmp);
}
g_free(tmp);
}
diff --git a/src/textview.c b/src/textview.c
@@ -1049,7 +1049,7 @@ static void textview_write_body(TextView *textview, MimeInfo *mimeinfo)
textview_show_html(textview, tmpfp, conv);
fclose(tmpfp);
}
- claws_unlink(filename);
+ unlink(filename);
}
g_free(filename);
} else if (!g_ascii_strcasecmp(mimeinfo->subtype, "enriched")) {
@@ -1062,7 +1062,7 @@ static void textview_write_body(TextView *textview, MimeInfo *mimeinfo)
textview_show_ertf(textview, tmpfp, conv);
fclose(tmpfp);
}
- claws_unlink(filename);
+ unlink(filename);
}
g_free(filename);
#ifndef G_OS_WIN32
diff --git a/src/wizard.c b/src/wizard.c
@@ -590,7 +590,7 @@ static void write_welcome_email(WizardWindow *wizard)
g_free(head);
g_free(body);
g_free(msg);
- claws_unlink(file);
+ unlink(file);
}
#undef XFACE