openbsd-ports/security/gksu-polkit/patches/patch-gksu_gksu-polkit_c
ajacoutot 0ec613faa4 Import gksu-polkit-0.0.2.
This is the new generation of gksu, a simple utility to run programs as
root, even in X-based environments.
This version uses the new libgksu-polkit library, which uses PolicyKit
for authorization purposes and a D-Bus service to actually perform the
work.

ok jasper@
2010-09-22 05:16:56 +00:00

50 lines
1.4 KiB
Plaintext

$OpenBSD: patch-gksu_gksu-polkit_c,v 1.1.1.1 2010/09/22 05:16:56 ajacoutot Exp $
Do not take 100% of the CPU in gksu-polkit when there's no stdin master
(upstream commit d7e31609efe8031dbd56b87caf4200330594488f)
--- gksu/gksu-polkit.c.orig Wed Feb 18 13:33:18 2009
+++ gksu/gksu-polkit.c Mon Sep 20 12:03:27 2010
@@ -20,7 +20,11 @@
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
+#ifdef __OpenBSD__
+#include <sys/wait.h>
+#else
#include <wait.h>
+#endif
#include <gtk/gtk.h>
#include <gksu-process.h>
@@ -89,6 +93,7 @@ static gboolean input_received (GIOChannel *channel,
{
GError *error = NULL;
GString *retstring;
+ GIOStatus status = G_IO_STATUS_AGAIN;
gchar buffer[1024];
gsize length = -1;
@@ -102,7 +107,6 @@ static gboolean input_received (GIOChannel *channel,
while(length != 0)
{
- GIOStatus status;
status = g_io_channel_read_chars(channel, buffer, 1024, &length, &error);
if(error)
{
@@ -112,10 +116,11 @@ static gboolean input_received (GIOChannel *channel,
g_string_append_len(retstring, buffer, length);
}
- gksu_write_queue_add(queue, retstring->str, retstring->len);
+ if (retstring->len > 0)
+ gksu_write_queue_add(queue, retstring->str, retstring->len);
g_string_free(retstring, TRUE);
- return TRUE;
+ return status != G_IO_STATUS_EOF;
}
static void kill_process_handler(int signum)