lib/port.c: getportent(): Remove obvious comments

And do some style changes on the corresponding code.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar
2024-07-02 14:26:19 +02:00
committed by Serge Hallyn
parent e790993c5d
commit f1f82c2105

View File

@@ -131,19 +131,14 @@ static struct port *getportent (void)
*/
next:
/*
* Get the next line and remove optional trailing '\n'.
* Lines which begin with '#' are all ignored.
*/
if (fgets (buf, sizeof buf, ports) == 0) {
if (fgets(buf, sizeof(buf), ports) == NULL) {
errno = saveerr;
return 0;
return NULL;
}
if ('#' == buf[0]) {
if ('#' == buf[0])
goto next;
}
stpcpy(strchrnul(buf, '\n'), "");
/*
* Get the name of the TTY device. It is the first colon
@@ -152,8 +147,6 @@ next:
* TTY devices.
*/
stpcpy(strchrnul(buf, '\n'), "");
port.pt_names = ttys;
for (cp = buf, j = 0; j < PORT_TTY; j++) {
port.pt_names[j] = cp;