* [PATCH] nfsrahead: getopt return type is int
@ 2022-05-13 19:18 Thiago Becker
2022-05-26 17:32 ` Steve Dickson
0 siblings, 1 reply; 2+ messages in thread
From: Thiago Becker @ 2022-05-13 19:18 UTC (permalink / raw)
To: linux-nfs; +Cc: steved, Thiago Becker
While compiling for aarch64, the compiler throws the warning below
because char is unsigned for aarch64.
main.c: In function ‘main’:
main.c:145:48: warning: comparison is always true due to limited range of data type [-Wtype-limits]
145 | while((opt = getopt(argc, argv, "dF")) != -1) {
|
This makes nfsrahead to run forever. Fix opt type to the same as getopt
type.
Signed-off-by: Thiago Becker <tbecker@redhat.com>
---
tools/nfsrahead/main.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tools/nfsrahead/main.c b/tools/nfsrahead/main.c
index 5fae941c..c83c6f71 100644
--- a/tools/nfsrahead/main.c
+++ b/tools/nfsrahead/main.c
@@ -135,10 +135,9 @@ static int conf_get_readahead(const char *kind) {
int main(int argc, char **argv)
{
- int ret = 0, retry;
+ int ret = 0, retry, opt;
struct device_info device;
unsigned int readahead = 128, log_level, log_stderr = 0;
- char opt;
log_level = D_ALL & ~D_GENERAL;
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] nfsrahead: getopt return type is int
2022-05-13 19:18 [PATCH] nfsrahead: getopt return type is int Thiago Becker
@ 2022-05-26 17:32 ` Steve Dickson
0 siblings, 0 replies; 2+ messages in thread
From: Steve Dickson @ 2022-05-26 17:32 UTC (permalink / raw)
To: Thiago Becker, linux-nfs
On 5/13/22 3:18 PM, Thiago Becker wrote:
> While compiling for aarch64, the compiler throws the warning below
> because char is unsigned for aarch64.
>
> main.c: In function ‘main’:
> main.c:145:48: warning: comparison is always true due to limited range of data type [-Wtype-limits]
> 145 | while((opt = getopt(argc, argv, "dF")) != -1) {
> |
>
> This makes nfsrahead to run forever. Fix opt type to the same as getopt
> type.
>
> Signed-off-by: Thiago Becker <tbecker@redhat.com>
Committed... (tag: nfs-utils-2-6-2-rc5)
steved
> ---
> tools/nfsrahead/main.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/tools/nfsrahead/main.c b/tools/nfsrahead/main.c
> index 5fae941c..c83c6f71 100644
> --- a/tools/nfsrahead/main.c
> +++ b/tools/nfsrahead/main.c
> @@ -135,10 +135,9 @@ static int conf_get_readahead(const char *kind) {
>
> int main(int argc, char **argv)
> {
> - int ret = 0, retry;
> + int ret = 0, retry, opt;
> struct device_info device;
> unsigned int readahead = 128, log_level, log_stderr = 0;
> - char opt;
>
>
> log_level = D_ALL & ~D_GENERAL;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-26 17:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-13 19:18 [PATCH] nfsrahead: getopt return type is int Thiago Becker
2022-05-26 17:32 ` Steve Dickson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.