[Pkg-shadow-commits] r2136 - in upstream/trunk: . libmisc

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Fri Jun 13 18:34:28 UTC 2008


Author: nekral-guest
Date: 2008-06-13 18:34:27 +0000 (Fri, 13 Jun 2008)
New Revision: 2136

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/libmisc/rlogin.c
Log:
	* libmisc/rlogin.c: The size argument of read() is a size_t.
	Propagate this time to the callers (the get_remote_string() and
	do_rlogin() functions).
	* libmisc/rlogin.c: Add brackets and parenthesis.
	* libmisc/rlogin.c: Avoid multi-statements lines.
	* libmisc/rlogin.c: Avoid assignments in comparisons.
	* libmisc/rlogin.c: Avoid implicit conversion of pointers to
	booleans.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2008-06-13 18:31:13 UTC (rev 2135)
+++ upstream/trunk/ChangeLog	2008-06-13 18:34:27 UTC (rev 2136)
@@ -1,5 +1,16 @@
 2008-06-13  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* libmisc/rlogin.c: The size argument of read() is a size_t.
+	Propagate this time to the callers (the get_remote_string() and
+	do_rlogin() functions).
+	* libmisc/rlogin.c: Add brackets and parenthesis.
+	* libmisc/rlogin.c: Avoid multi-statements lines.
+	* libmisc/rlogin.c: Avoid assignments in comparisons.
+	* libmisc/rlogin.c: Avoid implicit conversion of pointers to
+	booleans.
+
+2008-06-13  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* libmisc/failure.c: Avoid assignments in comparisons.
 	* libmisc/failure.c: read() returns a ssize_t.
 	* libmisc/failure.c: Add brackets and parenthesis.

Modified: upstream/trunk/libmisc/rlogin.c
===================================================================
--- upstream/trunk/libmisc/rlogin.c	2008-06-13 18:31:13 UTC (rev 2135)
+++ upstream/trunk/libmisc/rlogin.c	2008-06-13 18:34:27 UTC (rev 2136)
@@ -110,21 +110,25 @@
 	-1, -1}
 };
 
-static void get_remote_string (char *buf, int size)
+static void get_remote_string (char *buf, size_t size)
 {
 	for (;;) {
-		if (read (0, buf, 1) != 1)
+		if (read (0, buf, 1) != 1) {
 			exit (1);
-		if (*buf == '\0')
+		}
+		if ('\0' == *buf) {
 			return;
-		if (--size > 0)
+		}
+		--size;
+		if (size > 0) {
 			++buf;
+		}
 	}
  /*NOTREACHED*/}
 
 int
-do_rlogin (const char *remote_host, char *name, int namelen, char *term,
-	   int termlen)
+do_rlogin (const char *remote_host, char *name, size_t namelen, char *term,
+           size_t termlen)
 {
 	struct passwd *pwd;
 	char remote_name[32];
@@ -138,19 +142,24 @@
 	get_remote_string (name, namelen);
 	get_remote_string (term, termlen);
 
-	if ((cp = strchr (term, '/'))) {
-		*cp++ = '\0';
+	cp = strchr (term, '/');
+	if (NULL != cp) {
+		*cp = '\0';
+		cp++;
 
 		remote_speed = atoi (cp);
 		if (0 == remote_speed) {
 			remote_speed = 9600;
 		}
 	}
-	for (i = 0; speed_table[i].spd_baud != remote_speed &&
-	     speed_table[i].spd_name != -1; i++);
+	for (i = 0;
+	     (   (speed_table[i].spd_baud != remote_speed)
+	      && (speed_table[i].spd_name != -1));
+	     i++);
 
-	if (speed_table[i].spd_name != -1)
+	if (-1 != speed_table[i].spd_name) {
 		speed_name = speed_table[i].spd_name;
+	}
 
 	/*
 	 * Put the terminal in cooked mode with echo turned on.




More information about the Pkg-shadow-commits mailing list