This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[BUG] pututline () & rxvt: rxvt leaves stale utmp entries


On rxvt startup two utmp entries are created - the first one is created by
Cygwin and
the second one is created by rxvt itself:

$ who
Administ tty1         Aug  5 01:26 (MORDOR)
Administ tty2         Aug  5 01:26 (:0)

After rxvt shutdown:

$ who
Administ tty2         Aug  5 01:26 (:0)

The cause for this seems to be that rxvt assumes that the return value of
getutid () is
usable in a call to pututline (), which doesn't seem to hold true on Cygwin.
It turns out
that Cygwin uses the same static variable to return utmp entries to the
caller and
also for its own internal purposes i.e. searching for the right utmp entry.
I don't know if
Cygwin is right or not in this case, and there doesn't seem to be a lot of
on this topic. The linux man pages tells that the return value of getutid(),
getutline() and
getutent() is a static memory but doesn't say anything about what could
possibly happen
if one uses it back in a call to pututline(). So I guess the behaviour is
pretty much undefined.
On the other hand there is a comment in the Cygwin source of logout() which
indicates that
the author of putline () was aware of this behaviour so I draw the
conclusion that it is not 
a bug in Cygwin:

       /* We can't use ut further since it's a pointer to the static
        area (see below) and would get overwritten in pututline().  So we
        copy it back to the local ut_buf. */

I've created a simple testcase (attached) which when ran on Linux produces
the results that
rxvt expects. Unfortunately currently I do not have access to any other
unices on which I can
run the testcase.


COMPUTERBILD 15/03: Premium-e-mail-Dienste im Test
1. GMX TopMail - Platz 1 und Testsieger!
2. GMX ProMail - Platz 2 und Preis-Qualitätssieger!
3. Arcor - 4. - 5. T-Online - 6. - 7. daybyday - 8. e-Post

Attachment: ut.c
Description: Binary data

Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]