device/wwan: use nm_auto_close instead of gs_fd_close

(cherry picked from commit ed299cc860)
This commit is contained in:
Thomas Haller 2016-12-09 09:27:02 +01:00
parent f39138ea48
commit f16a9a2299

View file

@ -496,18 +496,18 @@ ppp_stats (NMPPPManager *ppp_manager,
static gboolean
port_speed_is_zero (const char *port)
{
struct termios options;
gs_fd_close int fd = -1;
struct termios options;
nm_auto_close int fd = -1;
fd = open (port, O_RDWR | O_NONBLOCK | O_NOCTTY);
if (fd < 0)
fd = open (port, O_RDWR | O_NONBLOCK | O_NOCTTY);
if (fd < 0)
return FALSE;
memset (&options, 0, sizeof (struct termios));
if (tcgetattr (fd, &options) != 0)
return FALSE;
memset (&options, 0, sizeof (struct termios));
if (tcgetattr (fd, &options) != 0)
return FALSE;
return cfgetospeed (&options) == B0;
return cfgetospeed (&options) == B0;
}
static NMActStageReturn