Use integer as getopt_long returns integer
From: Honggang Li <[email protected]>
ARM chars are unsigned by default. getopt_long return 255 instead -1. That will cause an endless loop for aarch64 platform.
--- rdma-ndd/rdma-ndd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
rdma-ndd/rdma-ndd.c +1 -1
@@ -297,7 +297,7 @@ int main(int argc, char *argv[]) { } }; -char c =getopt_long (argc, argv,"fh" , long_opts, &opt_idx); +int c =getopt_long (argc, argv,"fh" , long_opts, &opt_idx);if (c ==-1 )break ;
Signature · 6 lines
1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1493099392-1883-1-git-send-email-honli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Jason Gunthorpe
Reviewed-byQuoted 6 lines · Honggang LI
From: Honggang Li <[email protected]>
ARM chars are unsigned by default.
getopt_longreturn 255 instead -1. That will cause an endless loop for aarch64 platform.Signed-off-by Honggang Li <[email protected]>
Yep
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Jonathan Toppins
Acked-byQuoted 16 lines · Honggang LI
From: Honggang Li <[email protected]>
ARM chars are unsigned by default.
getopt_longreturn 255 instead -1. That will cause an endless loop for aarch64 platform.Signed-off-by Honggang Li <[email protected]>--- rdma-ndd/rdma-ndd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)rdma-ndd/rdma-ndd.c +0
-0
rdma-ndd/rdma-ndd.c int main(int argc, char *argv[]) · line 303
Quoted 8 lines
rdma-ndd/rdma-ndd.c +1
-1@@ -297,7 +297,7 @@ int main(int argc, char *argv[]) { } }; -char c =getopt_long (argc, argv,"fh" , long_opts, &opt_idx); +int c =getopt_long (argc, argv,"fh" , long_opts, &opt_idx);if (c ==-1 )break ;
int is the return type of the function signature anyway so this was wrong from the start.
https://linux.die.net/man/3/getopt_long
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Leon Romanovsky
Appliedrdma-ndd/rdma-ndd.c
Quoted 11 lines · Honggang LI
From: Honggang Li <[email protected]>
ARM chars are unsigned by default.
getopt_longreturn 255 instead -1. That will cause an endless loop for aarch64 platform.Signed-off-by Honggang Li <[email protected]>--- rdma-ndd/rdma-ndd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)rdma-ndd/rdma-ndd.c +0
-0
Thanks, applied.