You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.8 KiB
57 lines
1.8 KiB
From 9c6e9d8de2d236f630efdd6fddb6277e8664989b Mon Sep 17 00:00:00 2001
|
|
From: Andrey Albershteyn <aalbersh@redhat.com>
|
|
Date: Tue, 23 Apr 2024 14:36:17 +0200
|
|
Subject: [PATCH] xfs_fsr: convert fsrallfs to use time_t instead of int
|
|
|
|
Convert howlong argument to a time_t as it's truncated to int, but in
|
|
practice this is not an issue as duration will never be this big.
|
|
|
|
Add check for howlong to fit into int (printf can use int format
|
|
specifier). Even longer interval doesn't make much sense.
|
|
|
|
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
|
|
Reviewed-by: Christoph Hellwig <hch@lst.de>
|
|
Signed-off-by: Andrey Albershteyn <aalbersh@redhat.com>
|
|
---
|
|
fsr/xfs_fsr.c | 10 ++++++++--
|
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
|
|
index 3077d8f4..02d61ef9 100644
|
|
--- a/fsr/xfs_fsr.c
|
|
+++ b/fsr/xfs_fsr.c
|
|
@@ -72,7 +72,7 @@ static int packfile(char *fname, char *tname, int fd,
|
|
static void fsrdir(char *dirname);
|
|
static int fsrfs(char *mntdir, xfs_ino_t ino, int targetrange);
|
|
static void initallfs(char *mtab);
|
|
-static void fsrallfs(char *mtab, int howlong, char *leftofffile);
|
|
+static void fsrallfs(char *mtab, time_t howlong, char *leftofffile);
|
|
static void fsrall_cleanup(int timeout);
|
|
static int getnextents(int);
|
|
int xfsrtextsize(int fd);
|
|
@@ -165,6 +165,12 @@ main(int argc, char **argv)
|
|
break;
|
|
case 't':
|
|
howlong = atoi(optarg);
|
|
+ if (howlong > INT_MAX) {
|
|
+ fprintf(stderr,
|
|
+ _("%s: the maximum runtime is %d seconds.\n"),
|
|
+ optarg, INT_MAX);
|
|
+ exit(1);
|
|
+ }
|
|
break;
|
|
case 'f':
|
|
leftofffile = optarg;
|
|
@@ -387,7 +393,7 @@ initallfs(char *mtab)
|
|
}
|
|
|
|
static void
|
|
-fsrallfs(char *mtab, int howlong, char *leftofffile)
|
|
+fsrallfs(char *mtab, time_t howlong, char *leftofffile)
|
|
{
|
|
int fd;
|
|
int error;
|
|
--
|
|
2.45.2
|
|
|