[PATCH 1/3] agetty.c and c.h: supress compiler warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In the c.h the ignore_result marco caused few ISO C forbids
braced-groups within expressions warnings.

Rest of the fixes are trivial, such as missed initializer, unused
parameter and comparisions with signed and unsigned integers, and
one EXIT_* fix.

Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 include/c.h          |    2 +-
 login-utils/agetty.c |   15 ++++++++-------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/include/c.h b/include/c.h
index cfee616..96dbd10 100644
--- a/include/c.h
+++ b/include/c.h
@@ -62,7 +62,7 @@
 	_max1 > _max2 ? _max1 : _max2; })
 #endif
 
-#define ignore_result(x) ({ typeof(x) __dummy = (x); (void) __dummy; })
+#define ignore_result(x) ((void) (x))
 
 static inline __attribute__((const)) int is_power_of_2(unsigned long num)
 {
diff --git a/login-utils/agetty.c b/login-utils/agetty.c
index 57d1980..f8d51cc 100644
--- a/login-utils/agetty.c
+++ b/login-utils/agetty.c
@@ -159,7 +159,7 @@ struct chardata init_chardata = {
 
 struct Speedtab {
     long    speed;
-    int     code;
+    unsigned int code;
 };
 
 static struct Speedtab speedtab[] = {
@@ -205,7 +205,7 @@ int main P_((int argc, char **argv));
 void parse_args P_((int argc, char **argv, struct options *op));
 void parse_speeds P_((struct options *op, char *arg));
 void update_utmp P_((char *line));
-void open_tty P_((char *tty, struct termios *tp, int local));
+void open_tty P_((char *tty, struct termios *tp));
 void termio_init P_((struct termios *tp, struct options *op));
 void auto_baud P_((struct termios *tp));
 void do_prompt P_((struct options *op, struct termios *tp));
@@ -249,6 +249,8 @@ main(argc, argv)
 	"",				/* modem init string */
 	ISSUE,				/* default issue file */
 	0,				/* no baud rates known yet */
+	{ 0 },				/* baud rates to be tried */
+	0,				/* do not assume 8bit-clean tty */
     };
 
        setlocale(LC_ALL, "");
@@ -295,7 +297,7 @@ main(argc, argv)
 
     debug("calling open_tty\n");
     /* Open the tty as standard { input, output, error }. */
-    open_tty(options.tty, &termios, options.flags & F_LOCAL);
+    open_tty(options.tty, &termios);
 
     tcsetpgrp(0, getpid());
     /* Initialize the termios settings (raw mode, eight-bit, blocking i/o). */
@@ -615,10 +617,9 @@ update_utmp(line)
 
 /* open_tty - set up tty as standard { input, output, error } */
 void
-open_tty(tty, tp, local)
+open_tty(tty, tp)
      char   *tty;
      struct termios *tp;
-     int    local;
 {
     /* Get rid of the present standard { output, error} if any. */
 
@@ -1098,7 +1099,7 @@ char   *get_logname(op, cp, tp)
 	    default:
 		if (!isascii(ascval) || !isprint(ascval)) {
 		     /* ignore garbage characters */ ;
-		} else if (bp - logname >= sizeof(logname) - 1) {
+		} else if ((unsigned int) (bp - logname) >= sizeof(logname) - 1) {
 		    error(_("%s: input overrun"), op->tty);
 		} else {
 		    ignore_result( write(1, &c, 1) );	/* echo the character */
@@ -1302,5 +1303,5 @@ error(const char *fmt, ...) {
     }
 #endif
     (void) sleep((unsigned) 10);		/* be kind to init(8) */
-    exit(1);
+    exit(EXIT_FAILURE);
 }
-- 
1.7.3.5

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux