* is_my_tty returns a bool.
* Avoid implicit conversion of integers to booleans. * Add brackets.
This commit is contained in:
parent
06d2a32a3e
commit
b94825bbad
@ -1,3 +1,10 @@
|
|||||||
|
2008-05-25 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
|
* libmisc/chowntty.c: is_my_tty returns a bool.
|
||||||
|
* libmisc/chowntty.c: Avoid implicit conversion of integers to
|
||||||
|
booleans.
|
||||||
|
* libmisc/chowntty.c: Add brackets.
|
||||||
|
|
||||||
2008-05-25 Nicolas François <nicolas.francois@centraliens.net>
|
2008-05-25 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* libmisc/chowndir.c: Avoid assignment in comparisons, implicit
|
* libmisc/chowndir.c: Avoid assignment in comparisons, implicit
|
||||||
|
@ -46,17 +46,19 @@
|
|||||||
/*
|
/*
|
||||||
* is_my_tty -- determine if "tty" is the same as TTY stdin is using
|
* is_my_tty -- determine if "tty" is the same as TTY stdin is using
|
||||||
*/
|
*/
|
||||||
static int is_my_tty (const char *tty)
|
static bool is_my_tty (const char *tty)
|
||||||
{
|
{
|
||||||
struct stat by_name, by_fd;
|
struct stat by_name, by_fd;
|
||||||
|
|
||||||
if (stat (tty, &by_name) || fstat (0, &by_fd))
|
if ((stat (tty, &by_name) != 0) || (fstat (0, &by_fd) != 0)) {
|
||||||
return 0;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (by_name.st_rdev != by_fd.st_rdev)
|
if (by_name.st_rdev != by_fd.st_rdev) {
|
||||||
return 0;
|
return false;
|
||||||
else
|
} else {
|
||||||
return 1;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -102,8 +104,8 @@ void chown_tty (const char *tty, const struct passwd *info)
|
|||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chown (tty, info->pw_uid, gid) ||
|
if ((chown (tty, info->pw_uid, gid) != 0)||
|
||||||
chmod (tty, getdef_num ("TTYPERM", 0600))) {
|
(chmod (tty, getdef_num ("TTYPERM", 0600)) != 0)) {
|
||||||
int err = errno;
|
int err = errno;
|
||||||
|
|
||||||
snprintf (buf, sizeof buf, _("Unable to change tty %s"), tty);
|
snprintf (buf, sizeof buf, _("Unable to change tty %s"), tty);
|
||||||
|
Loading…
Reference in New Issue
Block a user