|
|
9376d4 |
From 57cf8d9bc0448abcb7f395d2a175be6b6373a569 Mon Sep 17 00:00:00 2001
|
|
|
9376d4 |
From: Jonathan Lebon <jlebon@redhat.com>
|
|
|
9376d4 |
Date: Thu, 15 Jun 2017 13:35:36 -0400
|
|
|
9376d4 |
Subject: [PATCH 4/4] postprocess: always nuke /var/run
|
|
|
9376d4 |
|
|
|
9376d4 |
If `/var/run` exists, it will be a dir, so we'll fail the `unlinkat`
|
|
|
9376d4 |
with `EISDIR`. Let's just explicitly nuke it.
|
|
|
9376d4 |
|
|
|
9376d4 |
Closes: #831
|
|
|
9376d4 |
Approved by: cgwalters
|
|
|
9376d4 |
---
|
|
|
9376d4 |
src/libpriv/rpmostree-postprocess.c | 7 +++++--
|
|
|
9376d4 |
1 file changed, 5 insertions(+), 2 deletions(-)
|
|
|
9376d4 |
|
|
|
9376d4 |
diff --git a/src/libpriv/rpmostree-postprocess.c b/src/libpriv/rpmostree-postprocess.c
|
|
|
9376d4 |
index 8252f41..094e7b8 100644
|
|
|
9376d4 |
--- a/src/libpriv/rpmostree-postprocess.c
|
|
|
9376d4 |
+++ b/src/libpriv/rpmostree-postprocess.c
|
|
|
9376d4 |
@@ -329,7 +329,6 @@ convert_var_to_tmpfiles_d (int src_rootfs_dfd,
|
|
|
9376d4 |
* runtime. (And really both in CentOS and Fedora)
|
|
|
9376d4 |
*/
|
|
|
9376d4 |
const char *known_state_files[] = {
|
|
|
9376d4 |
- "run", /* We never want to traverse into /run when making tmpfiles since it's a tmpfs */
|
|
|
9376d4 |
"lib/systemd/random-seed", /* https://bugzilla.redhat.com/show_bug.cgi?id=789407 */
|
|
|
9376d4 |
"lib/systemd/catalog/database",
|
|
|
9376d4 |
"lib/plymouth/boot-duration",
|
|
|
9376d4 |
@@ -340,6 +339,10 @@ convert_var_to_tmpfiles_d (int src_rootfs_dfd,
|
|
|
9376d4 |
if (!glnx_opendirat (src_rootfs_dfd, "var", TRUE, &var_dfd, error))
|
|
|
9376d4 |
return FALSE;
|
|
|
9376d4 |
|
|
|
9376d4 |
+ /* We never want to traverse into /run when making tmpfiles since it's a tmpfs */
|
|
|
9376d4 |
+ if (!glnx_shutil_rm_rf_at (var_dfd, "run", cancellable, error))
|
|
|
9376d4 |
+ return FALSE;
|
|
|
9376d4 |
+
|
|
|
9376d4 |
/* Here, delete some files ahead of time to avoid emitting warnings
|
|
|
9376d4 |
* for things that are known to be harmless.
|
|
|
9376d4 |
*/
|
|
|
9376d4 |
@@ -349,7 +352,7 @@ convert_var_to_tmpfiles_d (int src_rootfs_dfd,
|
|
|
9376d4 |
if (unlinkat (var_dfd, path, 0) < 0)
|
|
|
9376d4 |
{
|
|
|
9376d4 |
if (errno != ENOENT)
|
|
|
9376d4 |
- return glnx_throw_errno_prefix (error, "unlinkat");
|
|
|
9376d4 |
+ return glnx_throw_errno_prefix (error, "unlinkat(%s)", path);
|
|
|
9376d4 |
}
|
|
|
9376d4 |
}
|
|
|
9376d4 |
|
|
|
9376d4 |
--
|
|
|
9376d4 |
2.13.0
|
|
|
9376d4 |
|