summaryrefslogtreecommitdiff
path: root/src/analysis/db/cdb.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-04-11 21:46:03 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-04-11 21:46:03 (GMT)
commita4f2f3ec4b4cf7b894d6976c884fbc446396cd00 (patch)
tree0ef60529d585eb0e90b2df7eae60bdf4b1e327d3 /src/analysis/db/cdb.c
parent5ad85cf30b2355ca727904d1a0d25240283813b3 (diff)
Distinguished the internal server from the remote one using Unix sockets.
Diffstat (limited to 'src/analysis/db/cdb.c')
-rw-r--r--src/analysis/db/cdb.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/src/analysis/db/cdb.c b/src/analysis/db/cdb.c
index a42f838..e6a7005 100644
--- a/src/analysis/db/cdb.c
+++ b/src/analysis/db/cdb.c
@@ -49,7 +49,6 @@
#include "../../common/extstr.h"
#include "../../common/io.h"
#include "../../common/pathname.h"
-#include "../../common/xdg.h"
#include "../../common/xml.h"
#include "../../core/collections.h"
@@ -256,6 +255,7 @@ static void g_cdb_archive_finalize(GCdbArchive *archive)
{
//void close_xml_file(xmlDocPtr, xmlXPathContextPtr);
+ free(archive->filename);
G_OBJECT_CLASS(g_cdb_archive_parent_class)->finalize(G_OBJECT(archive));
@@ -265,10 +265,10 @@ static void g_cdb_archive_finalize(GCdbArchive *archive)
/******************************************************************************
* *
-* Paramètres : owner = description humaine du serveur d'accueil. *
-* hash = empreinte du binaire à représenter. *
-* user = désignation d'un éventuel nouveau créateur. *
-* error = indication éventuelle en cas d'échec. [OUT] *
+* Paramètres : basedir = répertoire de stockage des enregistrements. *
+* hash = empreinte du binaire à représenter. *
+* user = désignation d'un éventuel nouveau créateur. *
+* error = indication éventuelle en cas d'échec. [OUT] *
* *
* Description : Définit ou ouvre une archive d'éléments utilisateur. *
* *
@@ -279,10 +279,9 @@ static void g_cdb_archive_finalize(GCdbArchive *archive)
* *
******************************************************************************/
-GCdbArchive *g_cdb_archive_new(const char *owner, const rle_string *hash, const rle_string *user, DBError *error)
+GCdbArchive *g_cdb_archive_new(const char *basedir, const rle_string *hash, const rle_string *user, DBError *error)
{
GCdbArchive *result; /* Adresse à retourner */
- char *suffix; /* Fin du nom de fichier */
struct stat finfo; /* Information sur l'archive */
int ret; /* Retour d'un appel */
@@ -292,17 +291,10 @@ GCdbArchive *g_cdb_archive_new(const char *owner, const rle_string *hash, const
/* Chemin de l'archive */
- suffix = strdup("chrysalide" G_DIR_SEPARATOR_S);
- suffix = stradd(suffix, owner);
- suffix = stradd(suffix, G_DIR_SEPARATOR_S);
- suffix = stradd(suffix, hash->data);
- suffix = stradd(suffix, ".tar.xz");
-
- result->filename = get_xdg_config_dir(suffix);
-
- printf("dealing with '%s'...\n", result->filename);
-
- free(suffix);
+ result->filename = strdup(basedir);
+ result->filename = stradd(result->filename, G_DIR_SEPARATOR_S);
+ result->filename = stradd(result->filename, hash->data);
+ result->filename = stradd(result->filename, ".tar.xz");
if (!mkpath(result->filename))
goto gcan_error;
@@ -894,8 +886,6 @@ static void *g_cdb_archive_process(GCdbArchive *archive)
/* Lancement d'une phase de surveillance */
- printf("(%p) POLL %d\n", archive, nfds);
-
ret = poll(fds, nfds, -1);
if (ret == -1)
{