Advertisement
Guest User

Untitled

a guest
Jun 17th, 2013
612
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.78 KB | None | 0 0
  1. diff --git a/src/backend/utils/misc/ps_status.c b/src/backend/utils/misc/ps_status.c
  2. index 57aa384..4baacad 100644
  3. --- a/src/backend/utils/misc/ps_status.c
  4. +++ b/src/backend/utils/misc/ps_status.c
  5. @@ -29,6 +29,7 @@
  6.  #include "libpq/libpq.h"
  7.  #include "miscadmin.h"
  8.  #include "utils/ps_status.h"
  9. +#include "utils/guc.h"
  10.  
  11.  extern char **environ;
  12.  bool           update_process_title = true;
  13. @@ -289,6 +290,8 @@ void
  14.  set_ps_display(const char *activity, bool force)
  15.  {
  16.  #ifndef PS_USE_NONE
  17. +       int ps_buffer_dynamic_len;
  18. +
  19.         /* update_process_title=off disables updates, unless force = true */
  20.         if (!force && !update_process_title)
  21.                 return;
  22. @@ -303,9 +306,21 @@ set_ps_display(const char *activity, bool force)
  23.                 return;
  24.  #endif
  25.  
  26. +       ps_buffer_dynamic_len = 0;
  27. +       if (application_name)
  28. +       {
  29. +               strlcpy(ps_buffer + ps_buffer_fixed_size, application_name,
  30. +                               ps_buffer_size - ps_buffer_fixed_size);
  31. +               ps_buffer_dynamic_len = strlen(application_name);
  32. +               strlcpy(ps_buffer + ps_buffer_fixed_size + ps_buffer_dynamic_len, " ",
  33. +                               ps_buffer_size - ps_buffer_fixed_size - ps_buffer_dynamic_len);
  34. +               ps_buffer_dynamic_len++;
  35. +       }
  36. +
  37.         /* Update ps_buffer to contain both fixed part and activity */
  38. -       strlcpy(ps_buffer + ps_buffer_fixed_size, activity,
  39. -                       ps_buffer_size - ps_buffer_fixed_size);
  40. +       strlcpy(ps_buffer + ps_buffer_fixed_size + ps_buffer_dynamic_len, activity,
  41. +                       ps_buffer_size - ps_buffer_fixed_size - ps_buffer_dynamic_len);
  42. +
  43.         ps_buffer_cur_len = strlen(ps_buffer);
  44.  
  45.         /* Transmit new setting to kernel, if necessary */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement