[Xfce4-commits] <xfce4-panel:devel> Improve changing the process name of the wrapper a bit.

Nick Schermer nick at xfce.org
Tue Aug 11 20:28:07 CEST 2009


Updating branch refs/heads/devel
         to 8d224b024d8a857ada1ec50fcd0cd3ce87b2336f (commit)
       from d218813fbc7d50bfc8956d95bf39388dd1e74603 (commit)

commit 8d224b024d8a857ada1ec50fcd0cd3ce87b2336f
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Feb 22 12:31:54 2009 +0100

    Improve changing the process name of the wrapper a bit.
    
    Hopefully it will make less trouble on the platforms with
    support for the prctl call.

 wrapper/main.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/wrapper/main.c b/wrapper/main.c
index 4078798..6c5418b 100644
--- a/wrapper/main.c
+++ b/wrapper/main.c
@@ -198,7 +198,9 @@ main (gint argc, gchar **argv)
   DBusConnection          *dbus_connection;
   DBusGProxy              *dbus_gproxy;
   WrapperPlug             *plug;
+#if defined(HAVE_SYS_PRCTL_H) && defined(PR_SET_NAME)
   gchar                    process_name[16];
+#endif
 
   /* set translation domain */
   xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
@@ -250,9 +252,12 @@ main (gint argc, gchar **argv)
       return EXIT_FAILURE;
     }
 
+#if defined(HAVE_SYS_PRCTL_H) && defined(PR_SET_NAME)
   /* change the process name to something that makes sence */
   g_snprintf (process_name, sizeof (process_name), "panel-%s-%d", wrapper_name, opt_unique_id);
-  prctl (PR_SET_NAME, (gulong) process_name, 0, 0, 0);
+  if (prctl (PR_SET_NAME, (gulong) process_name, 0, 0, 0) == -1)
+    g_critical ("Failed to set the process name to %s", process_name);
+#endif
 
   /* try to connect to dbus */
   dbus_gconnection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);



More information about the Xfce4-commits mailing list