core: Port to new libglnx tempname API

Drops another libgsystem use, and as bonus we malloc less too.

Closes: #311
Approved by: jlebon
This commit is contained in:
Colin Walters 2016-05-29 13:06:36 -04:00 committed by Atomic Bot
parent 7748c361ef
commit 24cb0ffc6a
2 changed files with 3 additions and 4 deletions

@ -1 +1 @@
Subproject commit 3d162e772db80f6664a78583268150d2e1d1d29e Subproject commit afe3c3a86178c29ceaa3a5e46397ab2fa97202b3

View File

@ -989,14 +989,13 @@ _ostree_make_temporary_symlink_at (int tmp_dirfd,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
g_autofree char *tmpname = NULL; char *tmpname = g_strdup ("tmplink.XXXXXX");
guint i; guint i;
const int max_attempts = 128; const int max_attempts = 128;
for (i = 0; i < max_attempts; i++) for (i = 0; i < max_attempts; i++)
{ {
g_free (tmpname); glnx_gen_temp_name (tmpname);
tmpname = gs_fileutil_gen_tmp_name (NULL, NULL);
if (symlinkat (target, tmp_dirfd, tmpname) < 0) if (symlinkat (target, tmp_dirfd, tmpname) < 0)
{ {
if (errno == EEXIST) if (errno == EEXIST)