From patchwork Wed Aug 8 00:01:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geoff Levand X-Patchwork-Id: 954745 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41lWkv3Ly3z9s3q for ; Wed, 8 Aug 2018 10:01:27 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="nw6lPo2m"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41lWkv0P2dzDqgw for ; Wed, 8 Aug 2018 10:01:27 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="nw6lPo2m"; dkim-atps=neutral X-Original-To: Petitboot@lists.ozlabs.org Delivered-To: Petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=geoff@infradead.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="nw6lPo2m"; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41lWkj08ryzDqgw for ; Wed, 8 Aug 2018 10:01:13 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Date:Cc:To:Subject:From:References: In-Reply-To:Message-Id:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Sfwx09zvuOq+4bmX5wwAMbExLx9Y4rz8UA1+Frf+0jQ=; b=nw6lPo2mqeo1HH78O2WlA8eV3 yedHN1e0SiMNrfsnJUqSSnobfnzTp5JphOV+uc4lITz2B4rK7jOJ2+DRcEU6Bjga+1J7iJFmtlRL6 IejUJndafydjncLvCQ1z3muWyfSmTrI5VcN1SpV5SwEXJDoQzq/zEYWvPfXwz9mVL+DcikkWk9lbw EDgvbwi1v4hMa3qgMP04y13k1vm7bYcq6se60JUyDI6Wnpw08IGEmgCFf2+wsLI0h88Pvy0hsOwC8 +YapHY5TtuvujFSilVK/WGas03MgLX/qfFMhySCNBVoPv1TuiE/VNGextbYjQflpFyIuj/UmCTqPM qXd935U2Q==; Received: from geoff by merlin.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fnBuY-0004U1-BS; Wed, 08 Aug 2018 00:01:10 +0000 Message-Id: <6bac383be03d9d2219306f03b0d8421558ef732a.1533686335.git.geoff@infradead.org> In-Reply-To: References: From: Geoff Levand Patch-Date: Tue, 7 Aug 2018 16:54:47 -0700 Subject: [PATCH v1 6/6] lib/efi: Add check for ioctl_iflags support To: Samuel Mendoza-Jonas Date: Wed, 08 Aug 2018 00:01:10 +0000 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Petitboot@lists.ozlabs.org MIME-Version: 1.0 Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" 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 --- lib/efi/efivar.c | 19 +++++++++++++++++-- 1 file 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);