Tarantool development patches archive
 help / color / mirror / Atom feed
From: Cyrill Gorcunov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: tml <tarantool-patches@dev.tarantool.org>
Cc: Alexander Turenko <alexander.turenko@tarantool.org>
Subject: [Tarantool-patches] [PATCH] xlog: fix arguments processing in commit 8e429f4b7
Date: Thu,  4 Mar 2021 17:25:15 +0300	[thread overview]
Message-ID: <20210304142515.65862-1-gorcunov@gmail.com> (raw)

The order of evaluation of arguments passed to a function
is not a part of language standart but compiler specifics.
Thus make sure we pass proper "errno" to xdir_say_gc.

Note that this is not critical issue: in case of hit
we simply get wrong syserror message when file not
present on a storage device.

Reported-by: Aleksandr Lyapunov <alyapunov@tarantool.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
Guys, I didn't create a branch for this fix since it is not
critical and there is no issue for it. Even if the problem
occurs it won't affect the workflow so it is rather a cosmetic
fix.

 src/box/xlog.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/box/xlog.c b/src/box/xlog.c
index 974f460be..462245d27 100644
--- a/src/box/xlog.c
+++ b/src/box/xlog.c
@@ -684,10 +684,13 @@ xdir_collect_garbage(struct xdir *dir, int64_t signature, unsigned flags)
 	       vclock_sum(vclock) < signature) {
 		const char *filename =
 			xdir_format_filename(dir, vclock_sum(vclock), NONE);
-		if (flags & XDIR_GC_ASYNC)
+		if (flags & XDIR_GC_ASYNC) {
 			eio_unlink(filename, 0, xdir_complete_gc, NULL);
-		else
-			xdir_say_gc(unlink(filename), errno, filename);
+		} else {
+			int rc = unlink(filename);
+			int _errno = rc != 0 ? errno : 0;
+			xdir_say_gc(rc, _errno, filename);
+		}
 		vclockset_remove(&dir->index, vclock);
 		free(vclock);
 
-- 
2.29.2


             reply	other threads:[~2021-03-04 14:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-04 14:25 Cyrill Gorcunov via Tarantool-patches [this message]
2021-03-05  8:16 ` Aleksandr Lyapunov via Tarantool-patches
2021-03-05  8:26   ` Cyrill Gorcunov via Tarantool-patches
2021-03-05 10:14     ` Cyrill Gorcunov via Tarantool-patches

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=20210304142515.65862-1-gorcunov@gmail.com \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=alexander.turenko@tarantool.org \
    --cc=gorcunov@gmail.com \
    --subject='Re: [Tarantool-patches] [PATCH] xlog: fix arguments processing in commit 8e429f4b7' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox