summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2018-10-15 12:10:51 -0500
committerRuben Pollan <meskio@sindominio.net>2018-10-25 13:39:27 -0500
commit3425458fa72d26501408db06a47d23542b49c982 (patch)
tree98faa9fe1103b494d0ef927d466bc3d2953d3452
parentc9751aa9581e3eb771f6ed2578ddf792684153f0 (diff)
[feat] store temporary icons in /var/tmp
- Resolves: #26
-rw-r--r--systray.go1
-rw-r--r--vendor/github.com/getlantern/systray/systray_linux.c11
2 files changed, 10 insertions, 2 deletions
diff --git a/systray.go b/systray.go
index fbc89be..996c925 100644
--- a/systray.go
+++ b/systray.go
@@ -48,6 +48,7 @@ type gatewayTray struct {
}
func run(bm bitmask.Bitmask, conf *systrayConfig, notify *notificator, as autostart) {
+ os.Setenv("TMPDIR", "/var/tmp")
bt := bmTray{bm: bm, conf: conf, notify: notify, autostart: as}
systray.Run(bt.onReady, bt.onExit)
}
diff --git a/vendor/github.com/getlantern/systray/systray_linux.c b/vendor/github.com/getlantern/systray/systray_linux.c
index 3ed8ada..7ed58cd 100644
--- a/vendor/github.com/getlantern/systray/systray_linux.c
+++ b/vendor/github.com/getlantern/systray/systray_linux.c
@@ -48,9 +48,16 @@ void _unlink_temp_file() {
// runs in main thread, should always return FALSE to prevent gtk to execute it again
gboolean do_set_icon(gpointer data) {
- GBytes* bytes = (GBytes*)data;
_unlink_temp_file();
- strcpy(temp_file_name, "/tmp/systray_XXXXXX");
+ char *tmpdir = getenv("TMPDIR");
+ if (NULL == tmpdir) {
+ tmpdir = "/tmp";
+ }
+ strncpy(temp_file_name, tmpdir, PATH_MAX-1);
+ strncat(temp_file_name, "/systray_XXXXXX", PATH_MAX-1);
+ temp_file_name[PATH_MAX-1] = '\0';
+
+ GBytes* bytes = (GBytes*)data;
int fd = mkstemp(temp_file_name);
if (fd == -1) {
printf("failed to create temp icon file %s: %s\n", temp_file_name, strerror(errno));