public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Sami Kerola <kerolasa@iki.fi>
To: util-linux@vger.kernel.org
Cc: kerolasa@iki.fi
Subject: [PATCH] mkswap: add run time warning when maximum number of pages is exceeded
Date: Sun,  4 Aug 2013 10:59:50 +0100	[thread overview]
Message-ID: <1375610390-3590-1-git-send-email-kerolasa@iki.fi> (raw)

The commit f1477c4 mentioned in manual page swap header has a hard limit
for usable page count, which user will very likely miss unless there is a
run time warning.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 disk-utils/mkswap.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c
index 71503f4..16e7b1e 100644
--- a/disk-utils/mkswap.c
+++ b/disk-utils/mkswap.c
@@ -556,6 +556,9 @@ main(int argc, char **argv) {
 			(long)(MIN_GOODPAGES * pagesize/1024));
 		usage(stderr);
 	}
+	if (UINT_MAX < PAGES)
+		warnx(_("warning: swap area exceeds greatest number of supported pages by %llu"),
+			PAGES - UINT_MAX);
 
 #ifdef __linux__
 	if (get_linux_version() >= KERNEL_VERSION(2,3,4))
-- 
1.8.3.4


             reply	other threads:[~2013-08-04  9:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-04  9:59 Sami Kerola [this message]
2013-08-05  8:44 ` [PATCH] mkswap: add run time warning when maximum number of pages is exceeded Karel Zak

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=1375610390-3590-1-git-send-email-kerolasa@iki.fi \
    --to=kerolasa@iki.fi \
    --cc=util-linux@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox