Date: Tue, 2 Nov 2010 20:32:50 +0100 From: Ed Schouten <ed@80386.nl> To: Matthias Apitz <guru@unixarea.de> Cc: kde-freebsd@kde.org, freebsd-current@freebsd.org Subject: Re: 9-CURRENT: ports/net/kdenetwork3 does not compile Message-ID: <20101102193250.GU81149@hoeg.nl> In-Reply-To: <20101102061418.GA1884@current.Sisis.de> References: <20101102061418.GA1884@current.Sisis.de>
next in thread | previous in thread | raw e-mail | index | archive | help
--AJd+a2ML6L6CXP6l Content-Type: multipart/mixed; boundary="jtEtYGE75hrP1CgP" Content-Disposition: inline --jtEtYGE75hrP1CgP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello all, Just to notify everyone what's going on; Matthias tested a patch for me, which should make it work on HEAD again. The attached patch should be applied to the sources conditionally (so only when running HEAD). I am in the process of getting it fixed in ports/upstreamed. Greetings, --=20 Ed Schouten <ed@80386.nl> WWW: http://80386.nl/ --jtEtYGE75hrP1CgP Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="kdenetwork.txt" Content-Transfer-Encoding: quoted-printable --- ktalkd/ktalkd/find_user.cpp +++ ktalkd/ktalkd/find_user.cpp @@ -339,34 +339,33 @@ =20 #else /*not PROC_FIND_USER*/ =20 +#include <utmpx.h> + int find_user(char *name, char *tty, char *disp) { =20 - struct utmp ubuf; + struct utmpx *ubuf; int status; - FILE *fd; struct stat statb; - char ftty[20+UT_LINESIZE]; - char ttyFound[UT_LINESIZE] =3D ""; - char dispFound[UT_HOSTSIZE+1] =3D ""; - - if (!(fd =3D fopen(_PATH_UTMP, "r"))) { - fprintf(stderr, "talkd: can't read %s.\n", _PATH_UTMP); - return (FAILED); - } + char ftty[20 + sizeof ubuf->ut_line]; + char ttyFound[sizeof ubuf->ut_line] =3D ""; + char dispFound[sizeof ubuf->ut_line + 1] =3D ""; + + setutxent(); #define SCMPN(a, b) strncmp(a, b, sizeof (a)) status =3D NOT_HERE; (void) strcpy(ftty, _PATH_DEV); - while (fread((char *) &ubuf, sizeof ubuf, 1, fd) =3D=3D 1) { - if (!SCMPN(ubuf.ut_name, name)) { + while ((ubuf =3D getutxent())) { + if ((ubuf->ut_type =3D=3D USER_PROCESS) && + (!SCMPN(ubuf->ut_user, name))) { if (*tty =3D=3D '\0') { /* no particular tty was requested */ - (void) strcpy(ftty+5, ubuf.ut_line); + (void) strcpy(ftty+5, ubuf->ut_line); if (stat(ftty,&statb) =3D=3D 0) { if (!(statb.st_mode & 020)) /* ?character device? */ continue; - (void) strcpy(ttyFound, ubuf.ut_line); + (void) strcpy(ttyFound, ubuf->ut_line); #ifdef USE_UT_HOST - (void) strcpy(dispFound, ubuf.ut_host); + (void) strcpy(dispFound, ubuf->ut_host); strcat(dispFound, " "); #endif status =3D SUCCESS; @@ -384,13 +383,13 @@ } } } - else if (!strcmp(ubuf.ut_line, tty)) { + else if (!strcmp(ubuf->ut_line, tty)) { status =3D SUCCESS; break; } } } - fclose(fd); + endutxent(); if (status =3D=3D SUCCESS) { (void) strcpy(tty, ttyFound); (void) strcpy(disp, dispFound); --jtEtYGE75hrP1CgP-- --AJd+a2ML6L6CXP6l Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iEYEARECAAYFAkzQZ2IACgkQ52SDGA2eCwUK8wCdHtPLPSE84t/Lzr2UeoA53Gql q8oAnj6bxSSoKy3QoN1/DF9A6v1FApse =a1NZ -----END PGP SIGNATURE----- --AJd+a2ML6L6CXP6l--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101102193250.GU81149>