standardize on "return foo;" rather than "return(foo);" or "return (foo);"
This commit is contained in:
@@ -66,10 +66,10 @@ get_pty(int *master, int *slave, char *name, size_t namesz, uid_t ttyuid)
|
||||
ttygid = gr->gr_gid;
|
||||
|
||||
if (openpty(master, slave, name, NULL, NULL) != 0)
|
||||
return(0);
|
||||
return 0;
|
||||
if (chown(name, ttyuid, ttygid) != 0)
|
||||
return(0);
|
||||
return(1);
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#elif defined(HAVE__GETPTY)
|
||||
@@ -81,15 +81,15 @@ get_pty(int *master, int *slave, char *name, size_t namesz, uid_t ttyuid)
|
||||
/* IRIX-style dynamic ptys (may fork) */
|
||||
line = _getpty(master, O_RDWR, S_IRUSR|S_IWUSR|S_IWGRP, 0);
|
||||
if (line == NULL)
|
||||
return (0);
|
||||
return 0;
|
||||
*slave = open(line, O_RDWR|O_NOCTTY, 0);
|
||||
if (*slave == -1) {
|
||||
close(*master);
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
(void) chown(line, ttyuid, -1);
|
||||
strlcpy(name, line, namesz);
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
#elif defined(HAVE_GRANTPT)
|
||||
# ifndef HAVE_POSIX_OPENPT
|
||||
@@ -103,7 +103,7 @@ posix_openpt(int oflag)
|
||||
# else
|
||||
fd = open("/dev/ptmx", oflag);
|
||||
# endif
|
||||
return(fd);
|
||||
return fd;
|
||||
}
|
||||
# endif /* HAVE_POSIX_OPENPT */
|
||||
|
||||
@@ -114,22 +114,22 @@ get_pty(int *master, int *slave, char *name, size_t namesz, uid_t ttyuid)
|
||||
|
||||
*master = posix_openpt(O_RDWR|O_NOCTTY);
|
||||
if (*master == -1)
|
||||
return(0);
|
||||
return 0;
|
||||
|
||||
(void) grantpt(*master); /* may fork */
|
||||
if (unlockpt(*master) != 0) {
|
||||
close(*master);
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
line = ptsname(*master);
|
||||
if (line == NULL) {
|
||||
close(*master);
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
*slave = open(line, O_RDWR|O_NOCTTY, 0);
|
||||
if (*slave == -1) {
|
||||
close(*master);
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
# if defined(I_PUSH) && !defined(_AIX)
|
||||
ioctl(*slave, I_PUSH, "ptem"); /* pseudo tty emulation module */
|
||||
@@ -137,7 +137,7 @@ get_pty(int *master, int *slave, char *name, size_t namesz, uid_t ttyuid)
|
||||
# endif
|
||||
(void) chown(line, ttyuid, -1);
|
||||
strlcpy(name, line, namesz);
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else /* Old-style BSD ptys */
|
||||
@@ -161,7 +161,7 @@ get_pty(int *master, int *slave, char *name, size_t namesz, uid_t ttyuid)
|
||||
*master = open(line, O_RDWR|O_NOCTTY, 0);
|
||||
if (*master == -1) {
|
||||
if (errno == ENOENT)
|
||||
return(0); /* out of ptys */
|
||||
return 0; /* out of ptys */
|
||||
continue; /* already in use */
|
||||
}
|
||||
line[sizeof("/dev/p") - 2] = 't';
|
||||
@@ -173,11 +173,11 @@ get_pty(int *master, int *slave, char *name, size_t namesz, uid_t ttyuid)
|
||||
*slave = open(line, O_RDWR|O_NOCTTY, 0);
|
||||
if (*slave != -1) {
|
||||
strlcpy(name, line, namesz);
|
||||
return(1); /* success */
|
||||
return 1; /* success */
|
||||
}
|
||||
(void) close(*master);
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
#endif /* HAVE_OPENPTY */
|
||||
|
Reference in New Issue
Block a user