Correctly print out 'max' for max_fds
authorHannes Reinecke <hare@suse.de>
Tue, 16 Jul 2013 07:13:07 +0000 (09:13 +0200)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Tue, 16 Jul 2013 19:50:42 +0000 (21:50 +0200)
If the value specified for 'max_fds' is the system-wide limit
we should be printing out 'max', and not that value.

Signed-off-by: Hannes Reinecke <hare@suse.de>
libmultipath/dict.c

index b747fcd..6a58fa2 100644 (file)
@@ -2565,10 +2565,16 @@ snprint_def_rr_min_io_rq (char * buff, int len, void * data)
 static int
 snprint_max_fds (char * buff, int len, void * data)
 {
+       int r = 0, max_fds;
+
        if (!conf->max_fds)
                return 0;
 
-       return snprintf(buff, len, "%d", conf->max_fds);
+       r = get_sys_max_fds(&max_fds);
+       if (!r && max_fds == conf->max_fds)
+               return snprintf(buff, len, "\"max\"");
+       else
+               return snprintf(buff, len, "%d", conf->max_fds);
 }
 
 static int