[systemd-devel] [PATCH] system-update-generator: accept a dangling symlink
Lennart Poettering
lennart at poettering.net
Mon Jan 26 16:29:31 PST 2015
On Mon, 26.01.15 07:34, Zbigniew Jędrzejewski-Szmek (zbyszek at in.waw.pl) wrote:
I now commited this after changing this to laccess().
Thanks!
> The offline update mechanism is explicitly designed to work with a
> separate /var. systemd-update-generator is supposed to run early,
> before filesystems are mounted, so it cannot check if the
> /system-update symlink actually points to anything.
>
> The update is run *after* filesystems are mounted, so it should be
> able to access the target of the symlink without trouble.
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1178978
> ---
> src/system-update-generator/system-update-generator.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/system-update-generator/system-update-generator.c b/src/system-update-generator/system-update-generator.c
> index 464ee22b20..a8adbcb793 100644
> --- a/src/system-update-generator/system-update-generator.c
> +++ b/src/system-update-generator/system-update-generator.c
> @@ -37,7 +37,7 @@ static const char *arg_dest = "/tmp";
> static int generate_symlink(void) {
> const char *p = NULL;
>
> - if (access("/system-update", F_OK) < 0) {
> + if (faccessat(AT_FDCWD, "/system-update", F_OK, AT_SYMLINK_NOFOLLOW) < 0) {
> if (errno == ENOENT)
> return 0;
>
> --
> 2.1.1
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list