From 15742178d3bdd8fa93d9a168f434a62cbfdae761 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 12 Feb 2015 18:25:06 +0000 Subject: [PATCH] cope with not having an XDG_RUNTIME_DIR to restore This can happen if running integration tests under sudo. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61301 --- test/dbus-daemon.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/dbus-daemon.c b/test/dbus-daemon.c index edd8d0b..9e6f6a4 100644 --- a/test/dbus-daemon.c +++ b/test/dbus-daemon.c @@ -664,7 +664,10 @@ teardown (Fixture *f, g_assert_cmpint (g_rmdir (f->tmp_runtime_dir), ==, 0); /* we're relying on being single-threaded for this to be safe */ - g_setenv ("XDG_RUNTIME_DIR", f->saved_runtime_dir, TRUE); + if (f->saved_runtime_dir != NULL) + g_setenv ("XDG_RUNTIME_DIR", f->saved_runtime_dir, TRUE); + else + g_unsetenv ("XDG_RUNTIME_DIR"); g_free (f->saved_runtime_dir); g_free (f->tmp_runtime_dir); } -- 2.1.4