[Pkg-shadow-commits] r2134 - in upstream/trunk: . libmisc
nekral-guest at alioth.debian.org
nekral-guest at alioth.debian.org
Fri Jun 13 18:29:03 UTC 2008
Author: nekral-guest
Date: 2008-06-13 18:29:02 +0000 (Fri, 13 Jun 2008)
New Revision: 2134
Modified:
upstream/trunk/ChangeLog
upstream/trunk/libmisc/chowntty.c
Log:
* libmisc/chowntty.c: Avoid assignments in comparisons.
* libmisc/chowntty.c: Avoid implicit conversion of pointers to
booleans.
* libmisc/chowntty.c: Add brackets and parenthesis.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2008-06-13 18:24:37 UTC (rev 2133)
+++ upstream/trunk/ChangeLog 2008-06-13 18:29:02 UTC (rev 2134)
@@ -1,5 +1,12 @@
2008-06-13 Nicolas François <nicolas.francois at centraliens.net>
+ * libmisc/chowntty.c: Avoid assignments in comparisons.
+ * libmisc/chowntty.c: Avoid implicit conversion of pointers to
+ booleans.
+ * libmisc/chowntty.c: Add brackets and parenthesis.
+
+2008-06-13 Nicolas François <nicolas.francois at centraliens.net>
+
* libmisc/audit_help.c: Add brackets.
2008-06-13 Nicolas François <nicolas.francois at centraliens.net>
Modified: upstream/trunk/libmisc/chowntty.c
===================================================================
--- upstream/trunk/libmisc/chowntty.c 2008-06-13 18:24:37 UTC (rev 2133)
+++ upstream/trunk/libmisc/chowntty.c 2008-06-13 18:29:02 UTC (rev 2134)
@@ -78,21 +78,26 @@
* ID. Otherwise, use the user's primary group ID.
*/
- if (!(group = getdef_str ("TTYGROUP")))
+ group = getdef_str ("TTYGROUP");
+ if (NULL == group) {
gid = info->pw_gid;
- else if (group[0] >= '0' && group[0] <= '9')
- gid = atoi (group);
- else if ((grent = getgrnam (group))) /* local, no need for xgetgrnam */
- gid = grent->gr_gid;
- else
- gid = info->pw_gid;
+ } else if ((group[0] >= '0') && (group[0] <= '9')) {
+ gid = (gid_t) atol (group);
+ } else {
+ grent = getgrnam (group); /* local, no need for xgetgrnam */
+ if (NULL != grent) {
+ gid = grent->gr_gid;
+ } else {
+ gid = info->pw_gid;
+ }
+ }
/*
* Change the permissions on the TTY to be owned by the user with
* the group as determined above.
*/
- if (*tty != '/') {
+ if ('/' != *tty) {
snprintf (full_tty, sizeof full_tty, "/dev/%s", tty);
tty = full_tty;
}
@@ -104,8 +109,8 @@
exit (1);
}
- if ((chown (tty, info->pw_uid, gid) != 0)||
- (chmod (tty, getdef_num ("TTYPERM", 0600)) != 0)) {
+ 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);
@@ -115,8 +120,9 @@
info->pw_name));
closelog ();
- if (err != EROFS)
+ if (EROFS != err) {
exit (1);
+ }
}
#ifdef __linux__
/*
More information about the Pkg-shadow-commits
mailing list