[Pkg-shadow-commits] r2021 - in upstream/trunk: . libmisc
nekral-guest at alioth.debian.org
nekral-guest at alioth.debian.org
Sun May 25 21:33:40 UTC 2008
Author: nekral-guest
Date: 2008-05-25 21:33:38 +0000 (Sun, 25 May 2008)
New Revision: 2021
Modified:
upstream/trunk/ChangeLog
upstream/trunk/libmisc/chowntty.c
Log:
* is_my_tty returns a bool.
* Avoid implicit conversion of integers to booleans.
* Add brackets.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2008-05-25 21:23:28 UTC (rev 2020)
+++ upstream/trunk/ChangeLog 2008-05-25 21:33:38 UTC (rev 2021)
@@ -1,5 +1,12 @@
2008-05-25 Nicolas François <nicolas.francois at 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 at centraliens.net>
+
* libmisc/chowndir.c: Avoid assignment in comparisons, implicit
comparison of integers to booleans.
* libmisc/chowndir.c: The return value of closedir is not checked
Modified: upstream/trunk/libmisc/chowntty.c
===================================================================
--- upstream/trunk/libmisc/chowntty.c 2008-05-25 21:23:28 UTC (rev 2020)
+++ upstream/trunk/libmisc/chowntty.c 2008-05-25 21:33:38 UTC (rev 2021)
@@ -46,17 +46,19 @@
/*
* 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;
- if (stat (tty, &by_name) || fstat (0, &by_fd))
- return 0;
+ if ((stat (tty, &by_name) != 0) || (fstat (0, &by_fd) != 0)) {
+ return false;
+ }
- if (by_name.st_rdev != by_fd.st_rdev)
- return 0;
- else
- return 1;
+ if (by_name.st_rdev != by_fd.st_rdev) {
+ return false;
+ } else {
+ return true;
+ }
}
/*
@@ -102,8 +104,8 @@
exit (1);
}
- if (chown (tty, info->pw_uid, gid) ||
- chmod (tty, getdef_num ("TTYPERM", 0600))) {
+ if ((chown (tty, info->pw_uid, gid) != 0)||
+ (chmod (tty, getdef_num ("TTYPERM", 0600)) != 0)) {
int err = errno;
snprintf (buf, sizeof buf, _("Unable to change tty %s"), tty);
More information about the Pkg-shadow-commits
mailing list