All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 2/4] xfs_restore: check return value
Date: Fri, 22 Feb 2019 08:47:30 -0800	[thread overview]
Message-ID: <155085405082.5141.12150949924461780415.stgit@magnolia> (raw)
In-Reply-To: <155085403848.5141.1866278990901950186.stgit@magnolia>

From: Darrick J. Wong <darrick.wong@oracle.com>

Check the return value of the unlink call when creating a new file.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 restore/dirattr.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)


diff --git a/restore/dirattr.c b/restore/dirattr.c
index 0fb2877..4257a1b 100644
--- a/restore/dirattr.c
+++ b/restore/dirattr.c
@@ -67,7 +67,9 @@ create_filled_file(
 	int		fd;
 	int		ret;
 
-	(void)unlink(pathname);
+	ret = unlink(pathname);
+	if (ret && errno != ENOENT)
+		return ret;
 
 	fd = open(pathname, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
 	if (fd < 0)

  parent reply	other threads:[~2019-02-22 16:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-22 16:47 [PATCH 0/4] xfsdump: update to use fallocate Darrick J. Wong
2019-02-22 16:47 ` [PATCH 1/4] xfs_restore: refactor open-coded file creation code Darrick J. Wong
2019-02-22 19:20   ` Andre Noll
2019-02-22 19:28     ` Darrick J. Wong
2019-02-22 19:55       ` Andre Noll
2019-05-07  0:11   ` Allison Collins
2019-05-20 21:05     ` Darrick J. Wong
2019-02-22 16:47 ` Darrick J. Wong [this message]
2019-05-07  0:11   ` [PATCH 2/4] xfs_restore: check return value Allison Collins
2019-02-22 16:47 ` [PATCH 3/4] xfs_restore: fix unsupported ioctl detection Darrick J. Wong
2019-05-07  0:11   ` Allison Collins
2019-02-22 16:47 ` [PATCH 4/4] xfs_restore: support fallocate when reserving space for a file Darrick J. Wong
2019-05-07  0:11   ` Allison Collins
2019-05-06 18:24 ` [PATCH 0/4] xfsdump: update to use fallocate Darrick J. Wong
2019-08-20 20:21 Darrick J. Wong
2019-08-20 20:21 ` [PATCH 2/4] xfs_restore: check return value Darrick J. Wong

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=155085405082.5141.12150949924461780415.stgit@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.