freebsd-ports/x11/sessreg/files/patch-utmpx
Martin Wilke f4936121f9 - Update to Xorg 7.5
The Intel drivers was patched to work with
the new server. The drivers for Vesa, NV,NVIDIA and
ATI have been tested thoroughfully and seem to work fine.
A complete changelog of Xorg 7.5 can you read here:

http://www.x.org/releases/X11R7.5/

A note to FreeBSD 6.X users: We strongly recommend you
to update your system to 7.x or above.

For updating try

portupgrade -af \*

or:

portmaster -af

Please report any problems and issus to x11 (at) FreeBSD.org.

Thanks to beat@, rnoland@, fluffy@, stas@ and all testers for their help
and Feeback.

Tested by:	Community and 2x exp-runs
2010-05-01 11:41:07 +00:00

268 lines
6.2 KiB
Text

--- configure.ac.orig 2009-10-12 13:10:57.000000000 -0500
+++ configure.ac 2010-03-27 08:12:08.000000000 -0500
@@ -39,13 +39,14 @@
XORG_DEFAULT_OPTIONS
-AC_CHECK_HEADERS([lastlog.h utmpx.h sys/param.h])
+AC_CHECK_HEADERS([lastlog.h utmp.h utmpx.h sys/param.h])
AC_CHECK_MEMBER([struct utmpx.ut_syslen],
HAVE_SYSLEN=1,
HAVE_SYSLEN=0,
[#include <utmpx.h>])
AC_DEFINE_UNQUOTED(HAVE_UTMPX_UT_SYSLEN,$HAVE_SYSLEN,
[utmpx structure includes ut_syslen field])
+AC_CHECK_FUNCS([updwtmpx utmpxname])
AC_SYS_LARGEFILE
--- sessreg.c.orig 2009-10-12 12:52:12.000000000 -0500
+++ sessreg.c 2010-03-27 08:13:46.000000000 -0500
@@ -81,7 +81,6 @@
# include <X11/Xfuncs.h>
# include <stdio.h>
# include <stdlib.h>
-# include <utmp.h>
#if defined(__SVR4) || defined(SVR4) || defined(linux) || defined(__GLIBC__)
# define SYSV
@@ -90,7 +89,10 @@
#include <time.h>
#define Time_t time_t
-static void set_utmp (struct utmp *u, char *line, char *user, char *host, Time_t date, int addp);
+#ifdef USE_UTMP
+static void set_utmp (struct utmp *u, char *line, char *user, char *host,
+ Time_t date, int addp);
+#endif
#ifdef USE_UTMPX
static void set_utmpx (struct utmpx *u, const char *line, const char *user,
@@ -100,7 +102,12 @@
static int wflag, uflag, lflag;
static char *wtmp_file, *utmp_file, *line;
#ifdef USE_UTMPX
-static char *wtmpx_file = NULL, *utmpx_file = NULL;
+#ifdef HAVE_UPDWTMPX
+static char *wtmpx_file = NULL;
+#endif
+#ifdef HAVE_UTMPXNAME
+static char *utmpx_file = NULL;
+#endif
#endif
static int utmp_none, wtmp_none;
/*
@@ -109,7 +116,9 @@
*/
static int hflag, sflag, xflag, tflag;
static char *host_name = NULL;
+#ifdef USE_UTMP
static int slot_number;
+#endif
static char *xservers_file, *ttys_file;
static char *user_name;
static int aflag, dflag;
@@ -181,7 +190,7 @@
int
main (int argc, char **argv)
{
-#ifndef SYSV
+#if defined(USE_UTMP) && !defined(SYSV)
int utmp;
#endif
char *line_tmp;
@@ -189,7 +198,9 @@
int wtmp;
#endif
Time_t current_time;
+#ifdef USE_UTMP
struct utmp utmp_entry;
+#endif
#ifdef USE_UTMPX
struct utmpx utmpx_entry;
#endif
@@ -224,7 +235,9 @@
host_name = getstring (&argv, &hflag);
break;
case 's':
+#ifdef USE_UTMP
slot_number = atoi (getstring (&argv, &sflag));
+#endif
break;
case 'x':
xservers_file = getstring (&argv, &xflag);
@@ -250,14 +263,14 @@
/* set up default file names */
if (!wflag) {
wtmp_file = WTMP_FILE;
-#ifdef USE_UTMPX
+#if defined(USE_UTMPX) && defined(HAVE_UPDWTMPX)
wtmpx_file = WTMPX_FILE;
#endif
}
#ifndef NO_UTMP
if (!uflag) {
utmp_file = UTMP_FILE;
-#ifdef USE_UTMPX
+#if defined(USE_UTMPX) && defined(HAVE_UTMPXNAME)
utmpx_file = UTMPX_FILE;
#endif
}
@@ -268,7 +281,7 @@
if (!Lflag)
llog_file = LLOG_FILE;
#endif
-#if !defined(SYSV) && !defined(linux) && !defined(__QNX__)
+#if defined(USE_UTMP) && !defined(SYSV) && !defined(linux) && !defined(__QNX__)
if (!tflag)
ttys_file = TTYS_FILE;
if (!sflag && !utmp_none) {
@@ -287,34 +300,42 @@
line = line_tmp;
}
time (&current_time);
+#ifdef USE_UTMP
set_utmp (&utmp_entry, line, user_name, host_name, current_time, aflag);
+#endif
#ifdef USE_UTMPX
/* need to set utmpxname() before calling set_utmpx() for
UtmpxIdOpen to work */
+# ifdef HAVE_UTMPXNAME
if (utmpx_file != NULL) {
utmpxname (utmpx_file);
}
+# endif
set_utmpx (&utmpx_entry, line, user_name,
host_name, current_time, aflag);
#endif
if (!utmp_none) {
#ifdef USE_UTMPX
- if (utmpx_file != NULL) {
+# ifdef HAVE_UTMPX_NAME
+ if (utmpx_file != NULL)
+# endif
+ {
setutxent ();
(void) getutxid (&utmpx_entry);
pututxline (&utmpx_entry);
endutxent ();
}
#endif
-#ifdef SYSV
+#ifdef USE_UTMP
+# ifdef SYSV
utmpname (utmp_file);
setutent ();
(void) getutid (&utmp_entry);
pututline (&utmp_entry);
endutent ();
-#else
+# else
utmp = open (utmp_file, O_RDWR);
if (utmp != -1) {
syserr ((int) lseek (utmp, (long) slot_number * sizeof (struct utmp), 0), "lseek");
@@ -322,13 +343,16 @@
== sizeof (utmp_entry), "write utmp entry");
close (utmp);
}
-#endif
+# endif
+#endif /* USE_UTMP */
}
if (!wtmp_none) {
#ifdef USE_UTMPX
+# ifdef HAVE_UPDWTMPX
if (wtmpx_file != NULL) {
updwtmpx(wtmpx_file, &utmpx_entry);
}
+# endif
#else
wtmp = open (wtmp_file, O_WRONLY|O_APPEND);
if (wtmp != -1) {
@@ -371,6 +395,7 @@
* fill in the appropriate records of the utmp entry
*/
+#ifdef USE_UTMP
static void
set_utmp (struct utmp *u, char *line, char *user, char *host, Time_t date, int addp)
{
@@ -417,6 +442,7 @@
#endif
u->ut_time = date;
}
+#endif /* USE_UTMP */
#ifdef USE_UTMPX
static int
@@ -424,6 +450,8 @@
{
struct utmpx *u; /* pointer to entry in utmp file */
int status = 1; /* return code */
+
+ setutxent();
while ( (u = getutxent()) != NULL ) {
@@ -435,7 +463,7 @@
}
}
- endutent();
+ endutxent();
return (status);
}
@@ -454,14 +482,16 @@
(void) strncpy (u->ut_line, line, sizeof (u->ut_line));
strncpy(u->ut_host, line, sizeof(u->ut_host));
+#if HAVE_UTMPX_UT_SYSLEN
u->ut_syslen = strlen(line);
+#endif
}
else
bzero (u->ut_line, sizeof (u->ut_line));
if (addp && user)
- (void) strncpy (u->ut_name, user, sizeof (u->ut_name));
+ (void) strncpy (u->ut_user, user, sizeof (u->ut_user));
else
- bzero (u->ut_name, sizeof (u->ut_name));
+ bzero (u->ut_user, sizeof (u->ut_user));
if (line) {
int i;
@@ -520,7 +550,7 @@
}
#endif /* USE_UTMPX */
-#ifndef SYSV
+#if defined(USE_UTMP) && !defined(SYSV)
/*
* compute the slot-number for an X display. This is computed
* by counting the lines in /etc/ttys and adding the line-number
--- sessreg.h.orig 2008-06-11 16:30:54.000000000 -0500
+++ sessreg.h 2010-03-27 08:12:08.000000000 -0500
@@ -57,13 +57,15 @@
#include <sys/types.h>
#include <time.h>
-#include <utmp.h>
+
+#ifdef HAVE_UTMP_H
+# include <utmp.h>
+# define USE_UTMP
+#endif
#ifdef HAVE_UTMPX_H
-# if HAVE_UTMPX_UT_SYSLEN
-# include <utmpx.h>
-# define USE_UTMPX
-# endif
+# include <utmpx.h>
+# define USE_UTMPX
#endif
#ifdef HAVE_SYS_PARAM_H