openbsd-ports/sysutils/libgksu/patches/patch-libgksu_libgksu_c
2008-11-18 11:29:34 +00:00

53 lines
1.5 KiB
Plaintext

$OpenBSD: patch-libgksu_libgksu_c,v 1.3 2008/11/18 11:29:34 jasper Exp $
--- libgksu/libgksu.c.orig Wed May 28 02:00:44 2008
+++ libgksu/libgksu.c Tue Nov 18 12:20:53 2008
@@ -23,7 +23,12 @@
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
+#ifdef __OpenBSD__
+#include <sys/termios.h>
+#include <util.h>
+#else
#include <pty.h>
+#endif
#include <pwd.h>
#include <sys/types.h>
#include <sys/wait.h>
@@ -1081,6 +1086,7 @@ get_xauth_token (GksuContext *context, gchar *display)
FILE *xauth_output;
gchar *tmp = NULL;
gchar *xauth = g_new0 (gchar, 256);
+ size_t r;
/* find out where the xauth binary is located */
if (g_file_test ("/usr/bin/xauth", G_FILE_TEST_IS_EXECUTABLE))
@@ -1108,7 +1114,8 @@ get_xauth_token (GksuContext *context, gchar *display)
strerror(errno));
return NULL;
}
- fread (xauth, sizeof(char), 255, xauth_output);
+ r = fread (xauth, sizeof(char), 256, xauth_output);
+ xauth[r] = '\0';
pclose (xauth_output);
g_free (tmp);
@@ -1930,7 +1937,7 @@ gksu_su_full (GksuContext *context,
gchar **cmd = g_malloc (sizeof(gchar*)*7);
setsid(); // make us session leader
- cmd[i] = g_strdup ("/bin/su"); i++;
+ cmd[i] = g_strdup ("/usr/bin/su"); i++;
if (context->login_shell)
{
cmd[i] = g_strdup ("-"); i++;
@@ -1952,7 +1959,7 @@ gksu_su_full (GksuContext *context,
if (execv (cmd[0], cmd) == -1)
{
fprintf (stderr,
- "Unable to run /bin/su: %s",
+ "Unable to run /usr/bin/su: %s",
strerror(errno));
}