else if (errno != EAGAIN && errno != EACCES)
break;
if (!gotlock)
- { /* give it up */
+ {
+ /* give it up */
close (fd);
return;
}
strncpy (ut_id, pty + 3, sizeof (ut_id));
else if (sscanf (pty, "pts/%d", &i) == 1)
sprintf (ut_id, "vt%02x", (i & 0xff)); /* sysv naming */
- else if (strncmp (pty, "pty", 3) && strncmp (pty, "tty", 3))
+ else
{
ptytty_warn ("can't parse tty name \"%s\", not adding utmp entry.\n", pty);
return;
strncpy (ut->ut_id, ut_id, sizeof (ut->ut_id));
ut->ut_type = DEAD_PROCESS;
getutid (ut); /* position to entry in utmp file */
- strncpy (this->ut_id, ut_id, sizeof (this->ut_id));
# endif
#endif
strncpy (utx->ut_id, ut_id, sizeof (utx->ut_id));
utx->ut_type = DEAD_PROCESS;
getutxid (utx); /* position to entry in utmp file */
- strncpy (this->ut_id, ut_id, sizeof (this->ut_id));
#endif
#ifdef HAVE_STRUCT_UTMP
strncpy (ut->ut_line, pty, sizeof (ut->ut_line));
+# ifdef HAVE_UTMP_HOST
+ strncpy (ut->ut_host, hostname, sizeof (ut->ut_host));
+# endif
ut->ut_time = time (NULL);
# ifdef HAVE_UTMP_PID
strncpy (ut->ut_user, name, sizeof (ut->ut_user));
strncpy (ut->ut_id, ut_id, sizeof (ut->ut_id));
- ut->ut_time = time (NULL);
ut->ut_pid = cmd_pid;
-# ifdef HAVE_UTMP_HOST
- strncpy (ut->ut_host, hostname, sizeof (ut->ut_host));
-# endif
ut->ut_type = USER_PROCESS;
pututline (ut);
endutent (); /* close the file */
utmp_pos = 0;
# else
strncpy (ut->ut_name, name, sizeof (ut->ut_name));
-# ifdef HAVE_UTMP_HOST
- strncpy (ut->ut_host, hostname, sizeof (ut->ut_host));
-# endif
# endif
#endif
{
if (grantpt (pfd) == 0 /* change slave permissions */
&& unlockpt (pfd) == 0)
- { /* slave now unlocked */
+ {
+ /* slave now unlocked */
*ttydev = strdup (ptsname (pfd)); /* get slave's name */
return pfd;
}
struct group *gr = getgrnam ("tty");
if (gr)
- { /* change group ownership of tty to "tty" */
+ {
+ /* change group ownership of tty to "tty" */
mode = S_IRUSR | S_IWUSR | S_IWGRP;
gid = gr->gr_gid;
}