From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladimir Davydov Subject: [PATCH 1/5] xlog: fix filename in error messages Date: Sun, 7 Oct 2018 23:27:14 +0300 Message-Id: <3273817f5cb79af421a33b08a1539eb27a8ab9d2.1538942600.git.vdavydov.dev@gmail.com> In-Reply-To: References: In-Reply-To: References: To: kostja@tarantool.org Cc: tarantool-patches@freelists.org List-ID: - xlog_rename() doesn't strip xlog->filename of inprogress suffix so write errors will mistakenly report the filename as inprogress. - xlog_create() uses a name without inprogress suffix for error reporting while it actually creates an inprogress file. --- 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 d399a726..de5e52f7 100644 --- a/src/box/xlog.c +++ b/src/box/xlog.c @@ -744,6 +744,7 @@ xlog_rename(struct xlog *l) return -1; } l->is_inprogress = false; + filename[suffix - filename] = '\0'; return 0; } @@ -820,8 +821,9 @@ xlog_create(struct xlog *xlog, const char *name, int flags, */ xlog->fd = open(xlog->filename, flags, 0644); if (xlog->fd < 0) { - say_syserror("open, [%s]", name); - diag_set(SystemError, "failed to create file '%s'", name); + say_syserror("open, [%s]", xlog->filename); + diag_set(SystemError, "failed to create file '%s'", + xlog->filename); goto err_open; } @@ -834,7 +836,8 @@ xlog_create(struct xlog *xlog, const char *name, int flags, /* Write metadata */ if (fio_writen(xlog->fd, meta_buf, meta_len) < 0) { - diag_set(SystemError, "%s: failed to write xlog meta", name); + diag_set(SystemError, "%s: failed to write xlog meta", + xlog->filename); goto err_write; } -- 2.11.0