RE: [PATCH 1/1] fport_print: handle ttyname ENODEV

Rob Browning <[email protected]>
Newsgroups gmane.lisp.guile.devel
Message-ID <[email protected]>
Maxime Devos <[email protected]> writes:

> I don’t think the ‘#define FUNC_NAME "scm_i_c_ttyname"’ is actually
> doing something for scm_i_ttyname, given the absence of SCM_SYSERROR.

Ahh, thanks.  With the rework, I don't need that anymore.

> Since the internal function is only used in the same file as which it
> is defined in, you can make it a static function and remove it from
> posix.h.

It's also used in fports.c in the patch -- we need the helper so we can
get the errno in order to handle ENODEV in fport_print.

> And shouldn’t be the description of the function be right before the
> function declaration (and maybe before the #if too, dunno) instead of
> inside?

In this case, I was just including it as an indication of the helper's
intent rather than "real" documentation.

> Also, the locking is like...

OK, so you're saying that the existing scm_ttyname() is potentially
broken in these ways.  Assuming so, then I might see about handling that
right now, but I think it could also be filed as a bug for later.

And depending on what you mean by "non-standard", I don't know whether
that change (e.g. to allow EINTR to propagate, and to stop processing
ticks) could go into a stable release.

In any case, I'm happy to fix all the problems if we can be confident
we're not causing a regression, and not introducing something
inappropriate for a Z release -- I'll probably look into it a bit
further today, but for now, my more immediate goal is to fix the test by
fixing the ENODEV problem, without making anything worse.

> On length checks and the like: it isn’t clear to me whether
> TTY_NAME_MAX includes the terminating zero or not (I would expect not,
> like strlen).

I wsn't sure at first either, but then I saw that POSIX says "The value
of namesize is smaller than the length of the string to be returned
including the terminating null character" for the ERANGE case, so I
assumed it was included:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ttyname.html

Thanks
-- 
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.