bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] build: avoid another warning


From: Eric Blake
Subject: [PATCH] build: avoid another warning
Date: Wed, 31 Mar 2010 13:50:40 -0600

Noticed on cygwin:
get-mb-cur-max.c: In function 'main':
get-mb-cur-max.c:27: error: unused parameter 'argc' [-Wunused-parameter]

* tests/get-mb-cur-max.c (main): Use argc.
---

> Thanks.
> But how about using it rather than segfaulting when argc == 1?

Sure.  Here's what I pushed.  (However, it wouldn't have segfaulted:
setlocale(LC_ALL,NULL) is valid, after all).

 tests/get-mb-cur-max.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tests/get-mb-cur-max.c b/tests/get-mb-cur-max.c
index 48e2713..410b1b9 100644
--- a/tests/get-mb-cur-max.c
+++ b/tests/get-mb-cur-max.c
@@ -27,7 +27,7 @@ int
 main (int argc, char **argv)
 {
   set_program_name (argv[0]);
-  if (setlocale (LC_ALL, argv[1]))
+  if (1 < argc && setlocale (LC_ALL, argv[1]))
     {
       printf ("%d\n", (int) MB_CUR_MAX);
       exit (EXIT_SUCCESS);
-- 
1.6.6.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]