summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGeoff Levand <geoff@infradead.org>2018-08-08 00:01:10 +0000
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>2018-08-14 11:11:48 +1000
commit614843c3975578a9e5ee8451d00e6974c8326f75 (patch)
treebfea58d613b7735a3de5e7d19beb23554541d075 /lib
parentcacb745071a1137d39ef092717c22f76c31b4985 (diff)
downloadtalos-petitboot-614843c3975578a9e5ee8451d00e6974c8326f75.tar.gz
talos-petitboot-614843c3975578a9e5ee8451d00e6974c8326f75.zip
lib/efi: Add check for ioctl_iflags support
The efi tests may use a filesystem which does not support ioctl_iflags. Add a check and skip the ioctl_iflags operations if not supported. Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi/efivar.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/efi/efivar.c b/lib/efi/efivar.c
index 21c5d34..91b2507 100644
--- a/lib/efi/efivar.c
+++ b/lib/efi/efivar.c
@@ -83,17 +83,32 @@ int efi_del_variable(const char *guidstr, const char *name)
return -1;
rc = ioctl(fd, FS_IOC_GETFLAGS, &flag);
- if (rc == -1)
+ if (rc == -1 && errno == ENOTTY) {
+ pb_debug_fn("'%s' does not support ioctl_iflags.\n",
+ efivarfs_path);
+ goto delete;
+ } else if (rc == -1) {
+ pb_log_fn("FS_IOC_GETFLAGS failed: (%d) %s\n", errno,
+ strerror(errno));
goto exit;
+ }
flag &= ~FS_IMMUTABLE_FL;
rc = ioctl(fd, FS_IOC_SETFLAGS, &flag);
- if (rc == -1)
+ if (rc == -1) {
+ pb_log_fn("FS_IOC_SETFLAGS failed: (%d) %s\n", errno,
+ strerror(errno));
goto exit;
+ }
+delete:
close(fd);
fd = 0;
rc = unlink(path);
+ if (rc == -1) {
+ pb_log_fn("unlink failed: (%d) %s\n", errno, strerror(errno));
+ goto exit;
+ }
exit:
talloc_free(path);
close(fd);
OpenPOWER on IntegriCloud