public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: passt-dev@passt.top, lvivier@redhat.com,
	David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH v2 1/4] ${wd} is always set, no need to test for it
Date: Fri, 26 Apr 2024 12:01:05 +1000	[thread overview]
Message-ID: <20240426020108.1522375-2-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20240426020108.1522375-1-david@gibson.dropbear.id.au>

We unconditionally set ${wd} to a temporary directory, but there are some
places where we test if it is empty.  This appears to be stale code from
some earlier version, so simply remove it.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 mbuto | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mbuto b/mbuto
index 0609e7e..a6f80ab 100755
--- a/mbuto
+++ b/mbuto
@@ -369,7 +369,7 @@ cmd_check() {
 # cleanup() - Remove left-overs on exit, used from trap
 cleanup() {
 	[ -n "${ARCHIVEMOUNT}" ] && "${UMOUNT}" "${wd}" 2>/dev/null
-	[ -n "${wd}" ] && "${RM}" -rf "${wd}"
+	"${RM}" -rf "${wd}"
 	[ -n "${pkg_tmp}" ] && "${RM}" -f "${pkg_tmp}"
 	[ -n "${compress_test1}" ] && "${RM}" -f "${compress_test1}"
 	[ -n "${compress_test2}" ] && "${RM}" -f "${compress_test2}"
@@ -1044,7 +1044,6 @@ build() {
 # add() - Add contents to existing image
 # $1:	Item to be added
 add() {
-	[ -z "${wd}" ] && cpio_init
 	kmod_init
 
 	[ -e "${1}" ] && __path="${1}" || __path=$(command -v "${1}") || :
-- 
@@ -369,7 +369,7 @@ cmd_check() {
 # cleanup() - Remove left-overs on exit, used from trap
 cleanup() {
 	[ -n "${ARCHIVEMOUNT}" ] && "${UMOUNT}" "${wd}" 2>/dev/null
-	[ -n "${wd}" ] && "${RM}" -rf "${wd}"
+	"${RM}" -rf "${wd}"
 	[ -n "${pkg_tmp}" ] && "${RM}" -f "${pkg_tmp}"
 	[ -n "${compress_test1}" ] && "${RM}" -f "${compress_test1}"
 	[ -n "${compress_test2}" ] && "${RM}" -f "${compress_test2}"
@@ -1044,7 +1044,6 @@ build() {
 # add() - Add contents to existing image
 # $1:	Item to be added
 add() {
-	[ -z "${wd}" ] && cpio_init
 	kmod_init
 
 	[ -e "${1}" ] && __path="${1}" || __path=$(command -v "${1}") || :
-- 
2.44.0


  reply	other threads:[~2024-04-26  2:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-26  2:01 [PATCH v2 0/4] mbuto: Assorted fixes and simplifications David Gibson
2024-04-26  2:01 ` David Gibson [this message]
2024-04-26  2:01 ` [PATCH v2 2/4] Remove stale archivemount support David Gibson
2024-04-26  2:01 ` [PATCH v2 3/4] Split "auto" compression mode into its own path David Gibson
2024-04-26  2:01 ` [PATCH v2 4/4] Remove unnecessary cpio_init function David Gibson
2024-04-26  6:14 ` [PATCH v2 0/4] mbuto: Assorted fixes and simplifications Stefano Brivio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240426020108.1522375-2-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=lvivier@redhat.com \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).