summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2017-08-22 13:01:55 +0200
committerBastien Nocera <hadess@hadess.net>2017-08-22 13:09:22 +0200
commit842b59aaabc41fa57ea494f10d976c108d36bfbd (patch)
tree93d8d08cd11e87c14ba099ed7df28736d4faadcb
parent6013e767636f0447cf60ef595aae6c84ae3d5b76 (diff)
downloadgnome-desktop-842b59aaabc41fa57ea494f10d976c108d36bfbd.tar.gz
thumbnail: Throw a warning if thumbnailer leaves dangling files
When running sandboxed, we could make use "--tmpfs /tmp" to make /tmp disappear along with the thumbnailer, but that would just paper over the fact that those same discarded temporary files would be left in /tmp (RAM if tmpfs) when not sandboxed. So warn about badly behaved thumbnailers. https://bugzilla.gnome.org/show_bug.cgi?id=785238
-rw-r--r--libgnome-desktop/gnome-desktop-thumbnail-script.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libgnome-desktop/gnome-desktop-thumbnail-script.c b/libgnome-desktop/gnome-desktop-thumbnail-script.c
index f9a0184d..6002f23f 100644
--- a/libgnome-desktop/gnome-desktop-thumbnail-script.c
+++ b/libgnome-desktop/gnome-desktop-thumbnail-script.c
@@ -45,6 +45,7 @@
typedef struct {
gboolean sandbox;
+ char *thumbnailer_name;
GArray *fd_array;
/* Input/output file paths outside the sandbox */
char *infile;
@@ -556,6 +557,8 @@ expand_thumbnailing_cmd (const char *cmd,
if (!g_shell_parse_argv (cmd, NULL, &cmd_elems, error))
return NULL;
+ script->thumbnailer_name = g_strdup (cmd_elems[0]);
+
array = g_ptr_array_new_with_free_func (g_free);
#ifdef HAVE_BWRAP
@@ -647,6 +650,7 @@ script_exec_free (ScriptExec *exec)
if (exec == NULL)
return;
+ g_free (exec->thumbnailer_name);
g_free (exec->infile);
if (exec->infile_tmp)
{
@@ -660,7 +664,11 @@ script_exec_free (ScriptExec *exec)
}
if (exec->outdir)
{
- g_rmdir (exec->outdir);
+ if (g_rmdir (exec->outdir) < 0)
+ {
+ g_warning ("Could not remove %s, thumbnailer %s left files in directory",
+ exec->outdir, exec->thumbnailer_name);
+ }
g_free (exec->outdir);
}
g_free (exec->s_infile);