From 7d531a9bbf01e15573c4a5b9d6a06bd20eb2f983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Sun, 13 Dec 2015 22:44:18 +0100 Subject: [PATCH] Bump liberty --- degesch.c | 67 +------------------------------------------------------ liberty | 2 +- 2 files changed, 2 insertions(+), 67 deletions(-) diff --git a/degesch.c b/degesch.c index 1e93dc3..ba624de 100644 --- a/degesch.c +++ b/degesch.c @@ -1980,42 +1980,6 @@ get_aliases_config (struct app_context *ctx) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -static char * -write_configuration_file (const struct str *data, struct error **e) -{ - struct str path; - str_init (&path); - get_xdg_home_dir (&path, "XDG_CONFIG_HOME", ".config"); - str_append (&path, "/" PROGRAM_NAME); - - if (!mkdir_with_parents (path.str, e)) - goto error; - - str_append (&path, "/" PROGRAM_NAME ".conf"); - FILE *fp = fopen (path.str, "w"); - if (!fp) - { - error_set (e, "could not open `%s' for writing: %s", - path.str, strerror (errno)); - goto error; - } - - errno = 0; - fwrite (data->str, data->len, 1, fp); - fclose (fp); - - if (errno) - { - error_set (e, "writing to `%s' failed: %s", path.str, strerror (errno)); - goto error; - } - return str_steal (&path); - -error: - str_free (&path); - return NULL; -} - static void serialize_configuration (struct config_item *root, struct str *output) { @@ -7136,7 +7100,7 @@ save_configuration (struct app_context *ctx) serialize_configuration (ctx->config.root, &data); struct error *e = NULL; - char *filename = write_configuration_file (&data, &e); + char *filename = write_configuration_file (NULL, &data, &e); str_free (&data); if (!filename) @@ -10655,35 +10619,6 @@ app_editline_init (struct input *self) // --- Configuration loading --------------------------------------------------- -static bool -read_file (const char *filename, struct str *output, struct error **e) -{ - FILE *fp = fopen (filename, "rb"); - if (!fp) - { - error_set (e, "could not open `%s' for reading: %s", - filename, strerror (errno)); - return false; - } - - char buf[BUFSIZ]; - size_t len; - - while ((len = fread (buf, 1, sizeof buf, fp)) == sizeof buf) - str_append_data (output, buf, len); - str_append_data (output, buf, len); - - bool success = !ferror (fp); - fclose (fp); - - if (success) - return true; - - error_set (e, "error while reading `%s': %s", - filename, strerror (errno)); - return false; -} - static struct config_item * load_configuration_file (const char *filename, struct error **e) { diff --git a/liberty b/liberty index 91fca5c..8b2e41e 160000 --- a/liberty +++ b/liberty @@ -1 +1 @@ -Subproject commit 91fca5cb054fc95fe2e7ac090cac2c3a302565ca +Subproject commit 8b2e41ed8ffac0494763495896c6a80a9e9db543