libpriv/kernel: Use g_build_filename instead of g_strconcat

It's much easier to mess up with the latter than the former when
building filenames. There's a bunch more all over the codebase; just did
this bit to be consistent with the next commit which also uses it.
This commit is contained in:
Jonathan Lebon 2019-10-29 16:38:56 -04:00 committed by OpenShift Merge Robot
parent 122811a1ba
commit 6aa496e312

View File

@ -353,7 +353,7 @@ rpmostree_finalize_kernel (int rootfs_dfd,
GError **error) GError **error)
{ {
const char slash_bootdir[] = "boot"; const char slash_bootdir[] = "boot";
g_autofree char *modules_bootdir = g_strconcat ("usr/lib/modules/", kver, NULL); g_autofree char *modules_bootdir = g_build_filename ("usr/lib/modules", kver, NULL);
/* Calculate the sha256sum of the kernel+initramfs (called the "boot /* Calculate the sha256sum of the kernel+initramfs (called the "boot
* checksum"). We checksum the initramfs from the tmpfile fd (via mmap()) to * checksum"). We checksum the initramfs from the tmpfile fd (via mmap()) to
@ -371,7 +371,7 @@ rpmostree_finalize_kernel (int rootfs_dfd,
} }
const char *boot_checksum_str = g_checksum_get_string (boot_checksum); const char *boot_checksum_str = g_checksum_get_string (boot_checksum);
g_autofree char *kernel_modules_path = g_strconcat (modules_bootdir, "/vmlinuz", NULL);; g_autofree char *kernel_modules_path = g_build_filename (modules_bootdir, "vmlinuz", NULL);
/* It's possible the bootdir is already the modules directory; in that case, /* It's possible the bootdir is already the modules directory; in that case,
* we don't need to rename. * we don't need to rename.
*/ */
@ -394,7 +394,7 @@ rpmostree_finalize_kernel (int rootfs_dfd,
} }
/* Replace the initramfs */ /* Replace the initramfs */
g_autofree char *initramfs_modules_path = g_strconcat (modules_bootdir, "/initramfs.img", NULL); g_autofree char *initramfs_modules_path = g_build_filename (modules_bootdir, "initramfs.img", NULL);
if (unlinkat (rootfs_dfd, initramfs_modules_path, 0) < 0) if (unlinkat (rootfs_dfd, initramfs_modules_path, 0) < 0)
{ {
if (errno != ENOENT) if (errno != ENOENT)