[grilo/mocking: 5/8] net: Sanitize GRL_WEB_CAPTURE_DIR handling
- From: Mathias Hasselmann <hasselmm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo/mocking: 5/8] net: Sanitize GRL_WEB_CAPTURE_DIR handling
- Date: Thu, 11 Oct 2012 19:34:22 +0000 (UTC)
commit f21b57f433aca83c21910c1c636ce21ff667d278
Author: Mathias Hasselmann <mathias openismus com>
Date: Thu Oct 11 20:48:53 2012 +0200
net: Sanitize GRL_WEB_CAPTURE_DIR handling
libs/net/grl-net-private.c | 14 +++++---------
1 files changed, 5 insertions(+), 9 deletions(-)
---
diff --git a/libs/net/grl-net-private.c b/libs/net/grl-net-private.c
index 401c913..a030905 100644
--- a/libs/net/grl-net-private.c
+++ b/libs/net/grl-net-private.c
@@ -29,6 +29,8 @@
#include "grl-net-private.h"
+static const char *capture_dir = NULL;
+
void
parse_error (guint status,
const gchar *reason,
@@ -93,13 +95,10 @@ parse_error (guint status,
void
init_dump_directory ()
{
- const char *path;
-
- path = g_getenv ("GRL_WEB_CAPTURE_DIR");
- if (!path)
- return;
+ capture_dir = g_getenv ("GRL_WEB_CAPTURE_DIR");
- g_mkdir_with_parents (path, 0700);
+ if (capture_dir && g_mkdir_with_parents (capture_dir, 0700))
+ capture_dir = NULL;
}
void
@@ -107,12 +106,9 @@ dump_data (SoupURI *soup_uri,
const char *buffer,
const gsize length)
{
- const char *capture_dir;
char *uri, *escaped_uri, *file;
GError *error = NULL;
- capture_dir = g_getenv ("GRL_WEB_CAPTURE_DIR");
-
if (!capture_dir)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]