Fix syslog string processing
authorMatthias Clasen <mclasen@redhat.com>
Mon, 14 Feb 2011 16:30:11 +0000 (11:30 -0500)
committerColin Walters <walters@verbum.org>
Mon, 14 Feb 2011 16:32:03 +0000 (11:32 -0500)
squash_string_nonprintable didn't actually modify the string.

Reviewed-By: Colin Walters <walters@verbum.org>
dbus/dbus-sysdeps-util-unix.c

index 02954d5..ba8ca7f 100644 (file)
@@ -1058,11 +1058,11 @@ string_squash_nonprintable (DBusString *str)
   
   for (i = 0; i < len; i++)
     {
-         unsigned char c = (unsigned char) buf[i];
+      unsigned char c = (unsigned char) buf[i];
       if (c == '\0')
-        c = ' ';
+        buf[i] = ' ';
       else if (c < 0x20 || c > 127)
-        c = '?';
+        buf[i] = '?';
     }
 }
 
@@ -1132,10 +1132,10 @@ _dbus_command_for_pid (unsigned long  pid,
     goto fail;
   
   string_squash_nonprintable (&cmdline);  
-  
+
   if (!_dbus_string_copy (&cmdline, 0, str, _dbus_string_get_length (str)))
     goto oom;
-  
+
   _dbus_string_free (&cmdline);  
   _dbus_string_free (&path);
   return TRUE;