summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2016-07-08 12:57:12 -0400
committerColin Walters <walters@verbum.org>2016-07-08 13:09:19 -0400
commit78ae787757ab697bf92f49ec41a03c540550c887 (patch)
treeba0327e777aaa618f4cbe13b36ed4dc350185ab1
parent113c770dc1e7f29d9c5478661fdd89d0035079a7 (diff)
downloadlibglnx-78ae787757ab697bf92f49ec41a03c540550c887.tar.gz
fdio: Use correct dfd with O_TMPFILE in rename case
While auditing this code to figure out why ostree's `tests/test-refs.sh` was failing, while the bug turned out to be different, I noticed that in the case where `dfd != target_dfd`, we failed to do the right `renameat()`. (No code I'm aware of does this now).
-rw-r--r--glnx-fdio.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/glnx-fdio.c b/glnx-fdio.c
index c15639d..55eef09 100644
--- a/glnx-fdio.c
+++ b/glnx-fdio.c
@@ -255,7 +255,7 @@ glnx_link_tmpfile_at (int dfd,
g_set_error (error, G_IO_ERROR, G_IO_ERROR_EXISTS,
"Exhausted %u attempts to create temporary file", count);
}
- if (renameat (dfd, tmpname_buf, target_dfd, target) < 0)
+ if (renameat (target_dfd, tmpname_buf, target_dfd, target) < 0)
{
glnx_set_error_from_errno (error);
return FALSE;