From 20fc302df59ea7ca928756b8221faede31bcbab4 Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Mon, 13 Apr 2015 13:35:32 -0400
Subject: [PATCH] fdio: Canonicalize dfd for replace contents API

Just noticed while inspecting the code.
---
 glnx-fdio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/glnx-fdio.c b/glnx-fdio.c
index b45b927bc..db214dd55 100644
--- a/glnx-fdio.c
+++ b/glnx-fdio.c
@@ -649,6 +649,8 @@ glnx_file_replace_contents_with_perms_at (int                   dfd,
   g_autofree char *tmppath = g_strdup_printf ("/proc/self/fd/%d/.tmpXXXXXX", dfd);
   glnx_fd_close int fd = -1;
 
+  dfd = glnx_dirfd_canonicalize (dfd);
+
   if ((fd = mkostemp (tmppath, O_CLOEXEC)) == -1)
     {
       glnx_set_error_from_errno (error);
-- 
GitLab