NetworkManager uses deprecated termio instead of termios



Hi list!

For reference: https://bugzilla.redhat.com/show_bug.cgi?id=464760

While trying to compile NM-1:0.7.0-0.11.svn4022.2 on alpha, I ran into a
compile error:

"""
nm-serial-device.c: In function 'nm_serial_device_open':
nm-serial-device.c:348: error: array subscript is above array bounds
nm-serial-device.c:349: error: array subscript is above array bounds
"""

After analysing the problem, I found out that stdbuf is defined as "struct
termio". Take a look at termio.h:
"""
[oliver kriek ~]$ cat /usr/include/termio.h
/* Compatible <termio.h> for old `struct termio' ioctl interface.
   This is obsolete; use the POSIX.1 `struct termios' interface
   defined in <termios.h> instead.  */

#include <termios.h>
#include <sys/ioctl.h>
"""

A simple fix - at least for alpha - is to use "struct termios" instead (I'll
include a patch!). However, I have not tested this on x86 or any other platform - this is up to you! :-)


I see a lot of other places where termios is in use, so I guess it should be safe, to change the last termio as well...


Best,
 Oliver
diff -up NetworkManager-0.7.1/src/nm-serial-device.c.deprecated NetworkManager-0.7.1/src/nm-serial-device.c
--- NetworkManager-0.7.1/src/nm-serial-device.c.deprecated	2009-04-16 09:29:07.000000000 +0200
+++ NetworkManager-0.7.1/src/nm-serial-device.c	2009-04-16 09:29:49.000000000 +0200
@@ -346,7 +346,7 @@ static gboolean
 config_fd (NMSerialDevice *device, NMSettingSerial *setting)
 {
 	NMSerialDevicePrivate *priv = NM_SERIAL_DEVICE_GET_PRIVATE (device);
-	struct termio stbuf;
+	struct termios stbuf;
 	int speed;
 	int bits;
 	int parity;


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