diff options
author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-01-25 17:27:52 +0000 |
---|---|---|
committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-01-25 17:27:52 +0000 |
commit | 97e3051ec51ac5bdcb37a371249360163eaf5709 (patch) | |
tree | 9b73ed207630e7e9ce92e5dd4ff9fccccbae4e24 | |
parent | e28ba76d230192a1a970819cc3588b986a624ea2 (diff) |
set_nonblocking: removed err argument
-rw-r--r-- | audio/headset.c | 7 | ||||
-rw-r--r-- | common/dbus.c | 10 | ||||
-rw-r--r-- | common/dbus.h | 2 | ||||
-rw-r--r-- | hcid/dbus-rfcomm.c | 4 | ||||
-rw-r--r-- | 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)); |