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

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Mon May 26 00:02:18 UTC 2008


Author: nekral-guest
Date: 2008-05-26 00:02:15 +0000 (Mon, 26 May 2008)
New Revision: 2045

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/libmisc/ttytype.c
Log:
	* libmisc/ttytype.c: Avoid implicit conversion of pointers / integers to booleans.
	* libmisc/ttytype.c: Avoid assignments in comparisons.
	* libmisc/ttytype.c: Add brackets and parenthesis.
	* libmisc/ttytype.c: The return values of fclose is not checked on purpose.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2008-05-25 23:59:05 UTC (rev 2044)
+++ upstream/trunk/ChangeLog	2008-05-26 00:02:15 UTC (rev 2045)
@@ -1,5 +1,14 @@
 2008-05-26  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* libmisc/ttytype.c: Avoid implicit conversion of pointers /
+	integers to booleans.
+	* libmisc/ttytype.c: Avoid assignments in comparisons.
+	* libmisc/ttytype.c: Add brackets and parenthesis.
+	* libmisc/ttytype.c: The return values of fclose is not checked on
+	purpose.
+
+2008-05-26  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* libmisc/mail.c: Avoid implicit conversion of pointers to
 	booleans.
 	* libmisc/mail.c: Avoid assignments in comparisons.

Modified: upstream/trunk/libmisc/ttytype.c
===================================================================
--- upstream/trunk/libmisc/ttytype.c	2008-05-25 23:59:05 UTC (rev 2044)
+++ upstream/trunk/libmisc/ttytype.c	2008-05-26 00:02:15 UTC (rev 2045)
@@ -53,26 +53,33 @@
 		return;
 	if ((typefile = getdef_str ("TTYTYPE_FILE")) == NULL)
 		return;
-	if (access (typefile, F_OK))
+	if (access (typefile, F_OK) != 0)
 		return;
 
-	if (!(fp = fopen (typefile, "r"))) {
+	fp = fopen (typefile, "r");
+	if (NULL == fp) {
 		perror (typefile);
 		return;
 	}
-	while (fgets (buf, sizeof buf, fp)) {
-		if (buf[0] == '#')
+	while (fgets (buf, sizeof buf, fp) == buf) {
+		if (buf[0] == '#') {
 			continue;
+		}
 
-		if ((cp = strchr (buf, '\n')))
+		cp = strchr (buf, '\n');
+		if (NULL != cp) {
 			*cp = '\0';
+		}
 
-		if (sscanf (buf, "%s %s", type, port) == 2 &&
-		    strcmp (line, port) == 0)
+		if ((sscanf (buf, "%s %s", type, port) == 2) &&
+		    (strcmp (line, port) == 0)) {
 			break;
+		}
 	}
-	if (!feof (fp) && !ferror (fp))
+	if ((feof (fp) == 0) && (ferror (fp) == 0)) {
 		addenv ("TERM", type);
+	}
 
-	fclose (fp);
+	(void) fclose (fp);
 }
+




More information about the Pkg-shadow-commits mailing list