aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2020-10-10 04:37:08 +0200
committerPřemysl Eric Janouch <p@janouch.name>2020-10-10 04:37:08 +0200
commit59ac02d91f83521e31fbc56745496f8754765965 (patch)
treef4bd3c6d50dc5323db589c48960390faef64332a
parentd78cf10f04723b513e8b7b065a878643de777ed8 (diff)
downloadxK-59ac02d91f83521e31fbc56745496f8754765965.tar.gz
xK-59ac02d91f83521e31fbc56745496f8754765965.tar.xz
xK-59ac02d91f83521e31fbc56745496f8754765965.zip
Bump liberty
resolve_relative_runtime_unique_filename() used to have a bug.
-rw-r--r--common.c52
-rw-r--r--degesch.c2
m---------liberty0
3 files changed, 1 insertions, 53 deletions
diff --git a/common.c b/common.c
index 09a2e23..0837188 100644
--- a/common.c
+++ b/common.c
@@ -50,13 +50,6 @@ init_openssl (void)
// --- To be moved to liberty --------------------------------------------------
-static void
-cstr_set (char **s, char *new)
-{
- free (*s);
- *s = new;
-}
-
static ssize_t
strv_find (const struct strv *v, const char *s)
{
@@ -81,51 +74,6 @@ unixtime_msec (long *msec)
return tp.tv_sec;
}
-/// This differs from the non-unique version in that we expect the filename
-/// to be something like a pattern for mkstemp(), so the resulting path can
-/// reside in a system-wide directory with no risk of a conflict.
-static char *
-resolve_relative_runtime_unique_filename (const char *filename)
-{
- const char *runtime_dir = getenv ("XDG_RUNTIME_DIR");
- const char *tmpdir = getenv ("TMPDIR");
-
- struct str path = str_make ();
- if (runtime_dir && *runtime_dir == '/')
- str_append (&path, runtime_dir);
- else if (tmpdir && *tmpdir == '/')
- str_append (&path, tmpdir);
- else
- str_append (&path, "/tmp");
- str_append_printf (&path, "/%s/%s", PROGRAM_NAME, filename);
-
- // Try to create the file's ancestors;
- // typically the user will want to immediately create a file in there
- const char *last_slash = strrchr (path.str, '/');
- if (last_slash && last_slash != path.str)
- {
- char *copy = xstrndup (path.str, last_slash - path.str);
- (void) mkdir_with_parents (copy, NULL);
- free (copy);
- }
- return str_steal (&path);
-}
-
-static bool
-xwrite (int fd, const char *data, size_t len, struct error **e)
-{
- size_t written = 0;
- while (written < len)
- {
- ssize_t res = write (fd, data + written, len - written);
- if (res >= 0)
- written += res;
- else if (errno != EINTR)
- return error_set (e, "%s", strerror (errno));
- }
- return true;
-}
-
// --- Logging -----------------------------------------------------------------
static void
diff --git a/degesch.c b/degesch.c
index d3e31a8..acacd83 100644
--- a/degesch.c
+++ b/degesch.c
@@ -12585,7 +12585,7 @@ static char *
try_dump_input_to_file (struct app_context *ctx)
{
char *template = resolve_filename
- ("input.XXXXXX", resolve_relative_runtime_unique_filename);
+ ("input.XXXXXX", resolve_relative_runtime_template);
struct error *e = NULL;
if (dump_input_to_file (ctx, template, &e))
diff --git a/liberty b/liberty
-Subproject 7023c513477eca7832f5ae3c6204a7240c1401c
+Subproject e029aae1d3d1884ca868c3694bdec0456b3e826