From 97e3051ec51ac5bdcb37a371249360163eaf5709 Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Thu, 25 Jan 2007 17:27:52 +0000 Subject: set_nonblocking: removed err argument --- audio/headset.c | 7 +++++-- common/dbus.c | 10 +++------- common/dbus.h | 2 +- hcid/dbus-rfcomm.c | 4 +++- input/input-service.c | 2 +- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/audio/headset.c b/audio/headset.c index 55a47e8e..cb33f149 100644 --- a/audio/headset.c +++ b/audio/headset.c @@ -697,8 +697,10 @@ static int rfcomm_connect(struct headset *hs, int *err) goto failed; } - if (set_nonblocking(sk, err) < 0) + if (set_nonblocking(sk) < 0) { + *err = errno; goto failed; + } memset(&addr, 0, sizeof(addr)); addr.rc_family = AF_BLUETOOTH; @@ -1367,7 +1369,8 @@ static DBusHandlerResult hs_play(struct headset *hs, DBusMessage *msg) goto failed; } - if (set_nonblocking(sk, &err) < 0) { + if (set_nonblocking(sk) < 0) { + err = errno; err_connect_failed(connection, msg, err); goto failed; } diff --git a/common/dbus.c b/common/dbus.c index 92a86e73..bc1125fa 100644 --- a/common/dbus.c +++ b/common/dbus.c @@ -645,16 +645,14 @@ DBusHandlerResult simple_introspect(DBusConnection *conn, return send_message_and_unref(conn, reply); } -int set_nonblocking(int fd, int *err) +int set_nonblocking(int fd) { long arg; arg = fcntl(fd, F_GETFL); if (arg < 0) { - if (err) - *err = errno; error("fcntl(F_GETFL): %s (%d)", strerror(errno), errno); - return -1; + return -errno; } /* Return if already nonblocking */ @@ -663,11 +661,9 @@ int set_nonblocking(int fd, int *err) arg |= O_NONBLOCK; if (fcntl(fd, F_SETFL, arg) < 0) { - if (err) - *err = errno; error("fcntl(F_SETFL, O_NONBLOCK): %s (%d)", strerror(errno), errno); - return -1; + return -errno; } return 0; diff --git a/common/dbus.h b/common/dbus.h index d59903ee..f2bf45af 100644 --- a/common/dbus.h +++ b/common/dbus.h @@ -51,6 +51,6 @@ static inline DBusHandlerResult send_message_and_unref(DBusConnection *conn, DBu return DBUS_HANDLER_RESULT_HANDLED; } -int set_nonblocking(int fd, int *err); +int set_nonblocking(int fd); #endif /* __H_BLUEZ_DBUS_H__ */ diff --git a/hcid/dbus-rfcomm.c b/hcid/dbus-rfcomm.c index 3bae204f..d99939d1 100644 --- a/hcid/dbus-rfcomm.c +++ b/hcid/dbus-rfcomm.c @@ -448,8 +448,10 @@ static int rfcomm_connect(DBusConnection *conn, DBusMessage *msg, bdaddr_t *src, goto failed; } - if (set_nonblocking(sk, err) < 0) + if (set_nonblocking(sk) < 0) { + *err = errno; goto failed; + } /* So we can reply to the message later */ c->msg = dbus_message_ref(msg); diff --git a/input/input-service.c b/input/input-service.c index 871075a7..4f9345b3 100644 --- a/input/input-service.c +++ b/input/input-service.c @@ -374,7 +374,7 @@ static int l2cap_connect(struct pending_connect *pc, if (bind(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) goto failed; - if (set_nonblocking(sk, NULL) < 0) + if (set_nonblocking(sk) < 0) goto failed; memset(&opts, 0, sizeof(opts)); -- cgit