Blame SOURCES/BZ_1429361-if-very-long-h-c-t-l-then-append-space-rather-than-l.patch

9298dc
diff -Nur lsscsi-0.27_old/src/lsscsi.c lsscsi-0.27/src/lsscsi.c
9298dc
--- lsscsi-0.27_old/src/lsscsi.c	2017-03-15 19:59:47.642500506 +0800
9298dc
+++ lsscsi-0.27/src/lsscsi.c	2017-03-15 20:08:51.446308385 +0800
9298dc
@@ -25,6 +25,7 @@
9298dc
 #include <sys/stat.h>
9298dc
 #include <dirent.h>
9298dc
 #include <libgen.h>
9298dc
+#include <sys/sysmacros.h>
9298dc
 #include <linux/major.h>
9298dc
 #include <linux/limits.h>
9298dc
 #include <time.h>
9298dc
@@ -2504,7 +2505,10 @@
9298dc
         } else
9298dc
                 snprintf(value, sizeof(value), "[%s]", devname);
9298dc
 
9298dc
-        printf("%-*s", devname_len, value);
9298dc
+        if ((int)strlen(value) >= devname_len)
9298dc
+                 printf("%s ", value);  /* if very long, append a space */
9298dc
+        else /* left justified with field length of devname_len */
9298dc
+                printf("%-*s", devname_len, value);
9298dc
         if (! get_value(buff, "type", value, sizeof(value))) {
9298dc
                 printf("type?   ");
9298dc
         } else if (1 != sscanf(value, "%d", &type)) {