[systemd-devel] [PATCH] inhibit: ellipsize WHAT

Shawn Landden shawnlandden at gmail.com
Sat Nov 10 13:37:38 PST 2012


---
 src/login/inhibit.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/login/inhibit.c b/src/login/inhibit.c
index 4735df7..b6962c9 100644
--- a/src/login/inhibit.c
+++ b/src/login/inhibit.c
@@ -110,7 +110,7 @@ static int print_inhibitors(DBusConnection *bus, DBusError *error) {
         dbus_message_iter_recurse(&iter, &sub);
         while (dbus_message_iter_get_arg_type(&sub) != DBUS_TYPE_INVALID) {
                 const char *what, *who, *why, *mode;
-                char *ewho, *ewhy;
+                char *ewhat, *ewho, *ewhy;
                 dbus_uint32_t uid, pid;
 
                 if (dbus_message_iter_get_arg_type(&sub) != DBUS_TYPE_STRUCT) {
@@ -130,12 +130,14 @@ static int print_inhibitors(DBusConnection *bus, DBusError *error) {
                         goto finish;
                 }
 
+                ewhat= ellipsize(what,21, 66);
                 ewho = ellipsize(who, 20, 66);
                 ewhy = ellipsize(why, 20, 66);
 
                 printf("%-21s %-20s %-20s %-5s %6lu %6lu\n",
-                       what, ewho ? ewho : who, ewhy ? ewhy : why, mode, (unsigned long) uid, (unsigned long) pid);
+                       ewhat, ewho ? ewho : who, ewhy ? ewhy : why, mode, (unsigned long) uid, (unsigned long) pid);
 
+                free(ewhat);
                 free(ewho);
                 free(ewhy);
 
-- 
1.7.10.4



More information about the systemd-devel mailing list