Whamcloud - gitweb
LU-10480 liblustre: suppress progname prefix in output 19/30819/3
authorBobi Jam <bobijam.xu@intel.com>
Wed, 10 Jan 2018 00:59:32 +0000 (08:59 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 25 Jan 2018 04:45:33 +0000 (04:45 +0000)
Makes liblustre tool not prefix the progname before every output.

Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Change-Id: Ic8d4cfa19e739ae15048152ec63d90f4b2959d20
Reviewed-on: https://review.whamcloud.com/30819
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/utils/liblustreapi.c

index 7280528..a97ecb5 100644 (file)
@@ -129,11 +129,15 @@ static void error_callback_default(enum llapi_message_level level, int err,
 static void info_callback_default(enum llapi_message_level level, int err,
                                  const char *fmt, va_list ap)
 {
-       if (liblustreapi_cmd != NULL)
-               fprintf(stderr, "%s %s: ", program_invocation_short_name,
-                       liblustreapi_cmd);
-       else
-               fprintf(stderr, "%s: ", program_invocation_short_name);
+       if (err != 0) {
+               if (liblustreapi_cmd != NULL) {
+                       fprintf(stdout, "%s %s: ",
+                               program_invocation_short_name,
+                               liblustreapi_cmd);
+               } else {
+                       fprintf(stdout, "%s: ", program_invocation_short_name);
+               }
+       }
        vfprintf(stdout, fmt, ap);
 }