diff options
author | RĂ©mi Denis-Courmont <remi.denis-courmont@nokia.com> | 2009-08-20 10:52:57 +0300 |
---|---|---|
committer | Aki Niemi <aki.niemi@nokia.com> | 2009-08-20 11:08:25 +0300 |
commit | 89843ba662bad6c7f4f9438b8c8be584ff1604f1 (patch) | |
tree | ec8843c75e5d73eef464209991fdd9d85adc27fc | |
parent | 1f45e1ed3715dfcf7547cf3abdb72c156012e353 (diff) | |
download | ofono-89843ba662bad6c7f4f9438b8c8be584ff1604f1.tar.bz2 |
gisi: PEP: use more portable non-blocking and close-on-exec
-rw-r--r-- | gisi/pep.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -77,10 +77,13 @@ GIsiPEP *g_isi_pep_create(GIsiModem *modem) unsigned ifi = g_isi_modem_index(modem); char buf[IF_NAMESIZE]; - fd = socket(PF_PHONET, SOCK_SEQPACKET|SOCK_NONBLOCK|SOCK_CLOEXEC, 0); + fd = socket(PF_PHONET, SOCK_SEQPACKET, 0); if (fd == -1) return NULL; + fcntl(fd, F_SETFD, FD_CLOEXEC); + fcntl(fd, F_SETFL, O_NONBLOCK|fcntl(fd, F_GETFL)); + if (if_indextoname(ifi, buf) == NULL || setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, buf, IF_NAMESIZE)) goto error; |