grub2/0104-editenv-handle-relative-symlinks.patch
Javier Martinez Canillas 1f092caba7
Drop two efinet patches that were causing issues and a bunch of other fixes
Add comments and revert logic changes in 01_fallback_counting
Remove quotes when reading ID value from /etc/os-release
  Related: rhbz#1650706
blscfg: expand grub_users before passing to grub_normal_add_menu_entry()
  Resolves: rhbz#1650706
Drop buggy downstream patch "efinet: retransmit if our device is busy"
  Resolves: rhbz#1649048
Make the menu entry users option argument to be optional
  Related: rhbz#1652434
10_linux_bls: add missing menu entries options
  Resolves: rhbz#1652434
Drop "Be more aggro about actually using the *configured* network device."
  Resolves: rhbz#1654388
Fix menu entry selection based on title
  Resolves: rhbz#1654936

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2018-12-01 03:28:36 +01:00

51 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jonathan Lebon <jlebon@redhat.com>
Date: Mon, 14 Aug 2017 14:37:20 -0400
Subject: [PATCH] editenv: handle relative symlinks
Handle symlinks with targets relative to the containing dir. This
ensures that the rename operation does not depend on the cwd.
Resolves: rhbz#1479960
Signed-off-by: Jonathan Lebon <jlebon@redhat.com>
---
util/editenv.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/util/editenv.c b/util/editenv.c
index d8d1dad6ab9..41bc7cb1c9a 100644
--- a/util/editenv.c
+++ b/util/editenv.c
@@ -28,6 +28,7 @@
#include <errno.h>
#include <string.h>
+#include <libgen.h>
#define DEFAULT_ENVBLK_SIZE 1024
@@ -87,9 +88,20 @@ grub_util_create_envblk_file (const char *name)
continue;
}
- free (rename_target);
linkbuf[retsize] = '\0';
- rename_target = linkbuf;
+ if (linkbuf[0] == '/')
+ {
+ free (rename_target);
+ rename_target = linkbuf;
+ }
+ else
+ {
+ char *dbuf = xstrdup (rename_target);
+ const char *dir = dirname (dbuf);
+ free (rename_target);
+ rename_target = xasprintf("%s/%s", dir, linkbuf);
+ free (dbuf);
+ }
}
int rc = grub_util_rename (namenew, rename_target);