From b9d6ab9a7f9aebd1f5cc192538b033b767e61aaa Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sat, 14 Dec 2019 21:34:57 +0300 Subject: [PATCH] Check enough space when running nncp-bundle -rx --- doc/news.ru.texi | 4 ++++ doc/news.texi | 3 +++ src/cmd/nncp-bundle/main.go | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/doc/news.ru.texi b/doc/news.ru.texi index f7c4f13..fa95bf5 100644 --- a/doc/news.ru.texi +++ b/doc/news.ru.texi @@ -15,6 +15,10 @@ Исправлен некорректный код возврата @command{nncp-check} команды, который возвращал ошибку когда всё хорошо. +@item +Проверка свободного места для пакетов, во время выполнения +@command{nncp-bundle -rx}. + @end itemize @node Релиз 5.1.2 diff --git a/doc/news.texi b/doc/news.texi index 349880d..4613557 100644 --- a/doc/news.texi +++ b/doc/news.texi @@ -16,6 +16,9 @@ Most commands by default show oneline operations progress. Fixed incorrect @command{nncp-check} command return code, that returned bad code when everything is good. +@item +Free disk space check during @command{nncp-bundle -rx} call. + @end itemize @node Release 5.1.2 diff --git a/src/cmd/nncp-bundle/main.go b/src/cmd/nncp-bundle/main.go index 738012a..0bca23f 100644 --- a/src/cmd/nncp-bundle/main.go +++ b/src/cmd/nncp-bundle/main.go @@ -239,6 +239,10 @@ func main() { ctx.LogD("nncp-bundle", sds, "Too small packet") continue } + if !ctx.IsEnoughSpace(entry.Size) { + ctx.LogE("nncp-bundle", sds, errors.New("not enough spool space"), "") + continue + } pktName = filepath.Base(entry.Name) if _, err = nncp.FromBase32(pktName); err != nil { ctx.LogD("nncp-bundle", nncp.SdsAdd(sds, nncp.SDS{"err": "bad packet name"}), "") -- 2.44.0