|
Added
Link Here
|
| 1 |
--- libcyberjack/libdialog/dialog.c.orig 2011-11-11 08:13:13.000000000 +0100 |
| 2 |
+++ libcyberjack/libdialog/dialog.c 2013-01-19 23:05:27.659736536 +0100 |
| 3 |
@@ -22,7 +22,7 @@ |
| 4 |
* * |
| 5 |
***************************************************************************/ |
| 6 |
|
| 7 |
- |
| 8 |
+#include "config.h" |
| 9 |
#include "Platform.h" |
| 10 |
#include "dialog_p.h" |
| 11 |
#include "network.h" |
| 12 |
@@ -30,7 +30,11 @@ |
| 13 |
#include <sys/types.h> |
| 14 |
#include <sys/stat.h> |
| 15 |
#include <pwd.h> |
| 16 |
+#ifdef OS_FREEBSD |
| 17 |
+#include <utmpx.h> |
| 18 |
+#else |
| 19 |
#include <utmp.h> |
| 20 |
+#endif |
| 21 |
|
| 22 |
#include <errno.h> |
| 23 |
#include <string.h> |
| 24 |
@@ -120,11 +124,19 @@ |
| 25 |
|
| 26 |
static int rsct_dialog_mk_socket() { |
| 27 |
char buffer[256]; |
| 28 |
+#ifdef OS_FREEBSD |
| 29 |
+ struct utmpx *u_tmp_p; |
| 30 |
+#else |
| 31 |
struct utmp *u_tmp_p; |
| 32 |
+#endif |
| 33 |
struct passwd *pw; |
| 34 |
int sk; |
| 35 |
|
| 36 |
+#ifdef OS_FREEBSD |
| 37 |
+ while ((u_tmp_p = getutxent()) != NULL) { |
| 38 |
+#else |
| 39 |
while ((u_tmp_p = getutent()) != NULL) { |
| 40 |
+#endif |
| 41 |
DEBUGPI("RSCT: ut_type=%d, ut_line=[%s]\n", |
| 42 |
u_tmp_p->ut_type, |
| 43 |
u_tmp_p->ut_line); |
| 44 |
@@ -136,7 +148,11 @@ |
| 45 |
|
| 46 |
if (u_tmp_p==NULL) { |
| 47 |
DEBUGPE("RSCT: No user logged in at XServer :0 (%s (%d))\n", strerror(errno), errno); |
| 48 |
+#ifdef OS_FREEBSD |
| 49 |
+ endutxent(); |
| 50 |
+#else |
| 51 |
endutent(); |
| 52 |
+#endif |
| 53 |
return -1; |
| 54 |
} |
| 55 |
|
| 56 |
@@ -144,18 +160,31 @@ |
| 57 |
if (pw==NULL) { |
| 58 |
DEBUGPE("RSCT: Could not get home folder for user [%s]: %s (%d)\n", |
| 59 |
u_tmp_p->ut_user, strerror(errno), errno); |
| 60 |
+#ifdef OS_FREEBSD |
| 61 |
+ endutxent(); |
| 62 |
+#else |
| 63 |
endutent(); |
| 64 |
+#endif |
| 65 |
return -1; |
| 66 |
} |
| 67 |
|
| 68 |
if (pw->pw_dir==NULL || *(pw->pw_dir)==0) { |
| 69 |
DEBUGPE("RSCT: User [%s] has no home folder\n", u_tmp_p->ut_user); |
| 70 |
+#ifdef OS_FREEBSD |
| 71 |
+ endutxent(); |
| 72 |
+#else |
| 73 |
endutent(); |
| 74 |
+#endif |
| 75 |
return -1; |
| 76 |
} |
| 77 |
strncpy(buffer, pw->pw_dir, sizeof(buffer)-1); |
| 78 |
strncat(buffer, "/.cyberJack_gui_sock", sizeof(buffer)-1); |
| 79 |
+#ifdef OS_FREEBSD |
| 80 |
+ endutxent(); |
| 81 |
+#else |
| 82 |
endutent(); |
| 83 |
+#endif |
| 84 |
+ |
| 85 |
|
| 86 |
sk=rsct_net_connect_by_path(buffer); |
| 87 |
if (sk==-1) { |