From a3c6450444922802fefdbb64cbedc5ccf12da34e Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Mar 28 2011 20:30:25 +0000 Subject: - more personality work --- diff --git a/src/prefs.c b/src/prefs.c index e98f0b5..91d0034 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Red Hat, Inc. + * Copyright (C) 2010,2011 Red Hat, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,6 +23,7 @@ #include #include +#include "env.h" #include "prefs.h" #include "store-int.h" #include "submit.h" @@ -34,10 +35,7 @@ cm_prefs_read(void) const char *dir, *base = "/" PACKAGE_NAME ".conf"; char *path, *ret; ret = NULL; - dir = getenv(CM_STORE_CONFIG_DIRECTORY_ENV); - if (dir == NULL) { - dir = CM_STORE_CONFIG_DIRECTORY; - } + dir = cm_env_config_dir(); path = malloc(strlen(dir) + strlen(base) + 1); if (path != NULL) { sprintf(path, "%s%s", dir, base); diff --git a/src/store-files.c b/src/store-files.c index d97d998..5213ce2 100644 --- a/src/store-files.c +++ b/src/store-files.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009,2010 Red Hat, Inc. + * Copyright (C) 2009,2010,2011 Red Hat, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -992,10 +992,7 @@ cm_store_entry_save(struct cm_store_entry *entry) if (entry->cm_store_private == NULL) { cm_store_timestamp_from_time(time(NULL), timestamp); - directory = getenv(CM_STORE_REQUESTS_DIRECTORY_ENV); - if ((directory == NULL) || (strlen(directory) == 0)) { - directory = CM_STORE_REQUESTS_DIRECTORY; - } + directory = cm_env_request_dir(); snprintf(path, sizeof(path), "%s/%s", directory, timestamp); fd = open(path, O_WRONLY | O_CREAT | O_EXCL, @@ -1073,10 +1070,7 @@ cm_store_get_all_entries(void *parent) FILE *fp; glob_t globs; - directory = getenv(CM_STORE_REQUESTS_DIRECTORY_ENV); - if ((directory == NULL) || (strlen(directory) == 0)) { - directory = CM_STORE_REQUESTS_DIRECTORY; - } + directory = cm_env_request_dir(); snprintf(path, sizeof(path), "%s/*", directory); memset(&globs, 0, sizeof(globs)); ret = NULL; @@ -1193,10 +1187,7 @@ cm_store_ca_save(struct cm_store_ca *ca) if (ca->cm_store_private == NULL) { cm_store_timestamp_from_time(time(NULL), timestamp); - directory = getenv(CM_STORE_CAS_DIRECTORY_ENV); - if ((directory == NULL) || (strlen(directory) == 0)) { - directory = CM_STORE_CAS_DIRECTORY; - } + directory = cm_env_ca_dir(); snprintf(path, sizeof(path), "%s/%s", directory, timestamp); fd = open(path, O_WRONLY | O_CREAT | O_EXCL, @@ -1273,10 +1264,7 @@ cm_store_get_all_cas(void *parent) FILE *fp; glob_t globs; - directory = getenv(CM_STORE_CAS_DIRECTORY_ENV); - if ((directory == NULL) || (strlen(directory) == 0)) { - directory = CM_STORE_CAS_DIRECTORY; - } + directory = cm_env_ca_dir(); snprintf(path, sizeof(path), "%s/*", directory); memset(&globs, 0, sizeof(globs)); ret = NULL;