From be4addd6ae80f74f95318d3229d7e9485c077dcd Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 10 Mar 2008 13:10:17 +0000 Subject: [PATCH] 2008-03-10 Dan Williams * src/nm-serial-device.c - (config_fd): report error from TCSETA - (nm_serial_device_open): fail when config_fd() fails git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3410 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 6 ++++++ src/nm-serial-device.c | 14 +++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 46dde21e5d..3847a29c5f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-03-10 Dan Williams + + * src/nm-serial-device.c + - (config_fd): report error from TCSETA + - (nm_serial_device_open): fail when config_fd() fails + 2008-03-10 Dan Williams * src/nm-ip4-config.c diff --git a/src/nm-serial-device.c b/src/nm-serial-device.c index 558c759f8f..0d689ed546 100644 --- a/src/nm-serial-device.c +++ b/src/nm-serial-device.c @@ -241,7 +241,8 @@ config_fd (NMSerialDevice *device, NMSettingSerial *setting) stbuf.c_cflag |= (speed | bits | CREAD | 0 | parity | stopbits); if (ioctl (priv->fd, TCSETA, &stbuf) < 0) { - g_warning ("Can not control device"); + nm_warning ("(%s) cannot control device (errno %d)", + nm_device_get_iface (NM_DEVICE (device)), errno); return FALSE; } @@ -262,24 +263,27 @@ nm_serial_device_open (NMSerialDevice *device, priv = NM_SERIAL_DEVICE_GET_PRIVATE (device); iface = nm_device_get_iface (NM_DEVICE (device)); - nm_debug ("Opening device '%s'", iface); + nm_debug ("(%s) opening device...", iface); path = g_build_filename ("/dev", iface, NULL); priv->fd = open (path, O_RDWR | O_EXCL | O_NONBLOCK | O_NOCTTY); g_free (path); if (priv->fd < 0) { - nm_warning ("Can not open device '%s'", iface); + nm_warning ("(%s) cannot open device (errno %d)", iface, errno); return FALSE; } if (ioctl (priv->fd, TCGETA, &priv->old_t) < 0) { - nm_warning ("Can not control device '%s'", iface); + nm_warning ("(%s) cannot control device (errno %d)", iface, errno); close (priv->fd); return FALSE; } - config_fd (device, setting); + if (!config_fd (device, setting)) { + close (priv->fd); + return FALSE; + } priv->channel = g_io_channel_unix_new (priv->fd);