This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Issues in utmp/utmpx headers
- From: Brian Inglis <Brian dot Inglis at SystematicSw dot ab dot ca>
- To: cygwin at cygwin dot com
- Date: Tue, 29 Dec 2015 05:16:17 +0000 (UTC)
- Subject: Re: Issues in utmp/utmpx headers
- Authentication-results: sourceware.org; auth=none
- References: <CALiPeumt3nnNr=6P_p7WUUy1QHk6CBHXpv0i36Y3QanqoN3DbQ at mail dot gmail dot com> <loom dot 20151227T200026-993 at post dot gmane dot org> <CALiPeun3v+vME=6YU5bgvKp2ENv+csuLLSdKu5Jj0T9x66eQjw at mail dot gmail dot com>
> > David Lee <mailtolky <at> gmail.com> writes:
> >> While trying to port bsdgames to Cygwin I spotted the following issues:
> >> (1) In /usr/include/utmpx.h, utmpxname() is declared a void function.
> >> Should it return int?
> >> (2) In /usr/include/sys/utmp.h, utmpname() is declared a void
> >> function. Should it return int?
> >> (3) _PATH_UTMPX is not defined in any system headers.
> On 28 December 2015 at 03:02, Brian Inglis
> <Brian.Inglis <at> systematicsw.ab.ca> wrote:
> > Search packages for missing files e.g.
> > https://cygwin.com/cgi-bin2/package-grep.cgi?grep=utmp.h&arch=x86_64
> > brings up package cygwin-devel and cygwin32.
> > Download and run setup and select cygwin-devel to install the headers and
> > libraries.
David Lee <mailtolky <at> gmail.com> writes:
> The issue isn't missing, not-installed packages. The issues are (1)
> some function declaration seem wrong; and (2) a constant is missing.
Pardon my reading comprehension bork!
The utmpname implementation in newlib-cygwin/winsup/cygwin/syscalls.cc
could probably be improved to: avoid a memory leak; return -1 if
strdup fails, zero otherwise; default the path if a null pointer or string
argument is passed.
That would also fix utmpxname which is an alias.
Such a change would have little likely impact on downstream apps, but could
produce warnings about ignoring return values.
Unfortunately there appears to be no standard defined names to access the
default file name although GNU and Cygwin provide UTMP_FILE and UTMPX_FILE;
GNU also provide UTMP_FILENAME and UTMPX_FILENAME.
_PATH_UTMP and _PATH_UTMPX are implementation reserved names which may or
may not be provided, though adding the latter in paths.h would be trivial.
As the developers say, patches always welcome.
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple