use "%m" instead of "%s", strerror(errno) for syslog(3)
This commit is contained in:
parent
315d0953b6
commit
4c6d0d2a6f
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: bthcid.c,v 1.2 2006/07/26 11:00:07 tron Exp $ */
|
||||
/* $NetBSD: bthcid.c,v 1.3 2007/01/25 20:33:41 plunky Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006 Itronix Inc.
|
||||
@ -33,7 +33,7 @@
|
||||
__COPYRIGHT("@(#) Copyright (c) 2006 Itronix, Inc.\n"
|
||||
"@(#) Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>\n"
|
||||
"All rights reserved.\n");
|
||||
__RCSID("$NetBSD: bthcid.c,v 1.2 2006/07/26 11:00:07 tron Exp $");
|
||||
__RCSID("$NetBSD: bthcid.c,v 1.3 2007/01/25 20:33:41 plunky Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/stat.h>
|
||||
@ -141,9 +141,7 @@ main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
if (detach && pidfile(NULL) < 0) {
|
||||
syslog(LOG_ERR, "Could not create PID file. %s (%d)",
|
||||
strerror(errno), errno);
|
||||
|
||||
syslog(LOG_ERR, "Could not create PID file: %m");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: config.c,v 1.3 2006/07/30 19:36:39 plunky Exp $ */
|
||||
/* $NetBSD: config.c,v 1.4 2007/01/25 20:33:41 plunky Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006 Itronix Inc.
|
||||
@ -30,7 +30,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: config.c,v 1.3 2006/07/30 19:36:39 plunky Exp $");
|
||||
__RCSID("$NetBSD: config.c,v 1.4 2007/01/25 20:33:41 plunky Exp $");
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <prop/proplib.h>
|
||||
@ -132,9 +132,7 @@ save_key(bdaddr_t *laddr, bdaddr_t *raddr, uint8_t *key)
|
||||
if (cfg == NULL) {
|
||||
cfg = prop_dictionary_create();
|
||||
if (cfg == NULL) {
|
||||
syslog(LOG_ERR, "prop_dictionary_create() failed. %s (%d)",
|
||||
strerror(errno), errno);
|
||||
|
||||
syslog(LOG_ERR, "prop_dictionary_create() failed: %m");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -143,17 +141,13 @@ save_key(bdaddr_t *laddr, bdaddr_t *raddr, uint8_t *key)
|
||||
if (dev == NULL) {
|
||||
dev = prop_dictionary_create();
|
||||
if (dev == NULL) {
|
||||
syslog(LOG_ERR, "prop_dictionary_create() failed. %s (%d)",
|
||||
strerror(errno), errno);
|
||||
|
||||
syslog(LOG_ERR, "prop_dictionary_create() failed: %m");
|
||||
prop_object_release(cfg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!prop_dictionary_set(cfg, bt_ntoa(laddr, NULL), dev)) {
|
||||
syslog(LOG_ERR, "prop_dictionary_set() failed. %s (%d)",
|
||||
strerror(errno), errno);
|
||||
|
||||
syslog(LOG_ERR, "prop_dictionary_set() failed: %m");
|
||||
prop_object_release(dev);
|
||||
prop_object_release(cfg);
|
||||
return;
|
||||
@ -164,17 +158,13 @@ save_key(bdaddr_t *laddr, bdaddr_t *raddr, uint8_t *key)
|
||||
|
||||
dat = prop_data_create_data_nocopy(key, HCI_KEY_SIZE);
|
||||
if (dat == NULL) {
|
||||
syslog(LOG_ERR, "Cannot create data object. %s (%d)",
|
||||
strerror(errno), errno);
|
||||
|
||||
syslog(LOG_ERR, "Cannot create data object: %m");
|
||||
prop_object_release(cfg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!prop_dictionary_set(dev, bt_ntoa(raddr, NULL), dat)) {
|
||||
syslog(LOG_ERR, "prop_dictionary_set() failed. %s (%d)",
|
||||
strerror(errno), errno);
|
||||
|
||||
syslog(LOG_ERR, "prop_dictionary_set() failed: %m");
|
||||
prop_object_release(dat);
|
||||
prop_object_release(cfg);
|
||||
return;
|
||||
@ -184,9 +174,7 @@ save_key(bdaddr_t *laddr, bdaddr_t *raddr, uint8_t *key)
|
||||
|
||||
xml = prop_dictionary_externalize(cfg);
|
||||
if (xml == NULL) {
|
||||
syslog(LOG_ERR, "prop_dictionary_externalize() failed. %s (%d)",
|
||||
strerror(errno), errno);
|
||||
|
||||
syslog(LOG_ERR, "prop_dictionary_externalize() failed: %m");
|
||||
prop_object_release(cfg);
|
||||
return;
|
||||
}
|
||||
@ -195,18 +183,14 @@ save_key(bdaddr_t *laddr, bdaddr_t *raddr, uint8_t *key)
|
||||
|
||||
fd = open(new_key_file, O_WRONLY|O_TRUNC|O_CREAT|O_EXLOCK, 0600);
|
||||
if (fd < 0) {
|
||||
syslog(LOG_ERR, "Cannot open new keyfile %s. %s (%d)",
|
||||
key_file, strerror(errno), errno);
|
||||
|
||||
syslog(LOG_ERR, "Cannot open new keyfile %s: %m", key_file);
|
||||
free(xml);
|
||||
return;
|
||||
}
|
||||
|
||||
len = strlen(xml);
|
||||
if (write(fd, xml, len) != len) {
|
||||
syslog(LOG_ERR, "Write of keyfile failed. %s (%d)",
|
||||
strerror(errno), errno);
|
||||
|
||||
syslog(LOG_ERR, "Write of keyfile failed: %m");
|
||||
free(xml);
|
||||
close(fd);
|
||||
unlink(new_key_file);
|
||||
@ -217,8 +201,8 @@ save_key(bdaddr_t *laddr, bdaddr_t *raddr, uint8_t *key)
|
||||
close(fd);
|
||||
|
||||
if (rename(new_key_file, key_file) < 0) {
|
||||
syslog(LOG_ERR, "rename(%s, %s) failed. %s (%d)",
|
||||
new_key_file, key_file, strerror(errno), errno);
|
||||
syslog(LOG_ERR, "rename(%s, %s) failed: %m",
|
||||
new_key_file, key_file);
|
||||
|
||||
unlink(new_key_file);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: hci.c,v 1.1 2006/06/19 15:44:56 gdamore Exp $ */
|
||||
/* $NetBSD: hci.c,v 1.2 2007/01/25 20:33:41 plunky Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006 Itronix Inc.
|
||||
@ -55,7 +55,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: hci.c,v 1.1 2006/06/19 15:44:56 gdamore Exp $");
|
||||
__RCSID("$NetBSD: hci.c,v 1.2 2007/01/25 20:33:41 plunky Exp $");
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/time.h>
|
||||
@ -142,9 +142,7 @@ process_hci(int sock, short ev, void *arg)
|
||||
n = recvfrom(sock, buffer, sizeof(buffer), 0,
|
||||
(struct sockaddr *) &addr, &size);
|
||||
if (n < 0) {
|
||||
syslog(LOG_ERR, "Could not receive from HCI socket. "
|
||||
"%s (%d)", strerror(errno), errno);
|
||||
|
||||
syslog(LOG_ERR, "Could not receive from HCI socket: %m");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -269,11 +267,9 @@ send_pin_code_reply(int sock, struct sockaddr_bt *addr,
|
||||
|
||||
if (n < 0) {
|
||||
syslog(LOG_ERR, "Could not send PIN code reply to %s "
|
||||
"for remote bdaddr %s. %s (%d)",
|
||||
"for remote bdaddr %s: %m",
|
||||
dev_name,
|
||||
bt_ntoa(bdaddr, NULL),
|
||||
strerror(errno),
|
||||
errno);
|
||||
bt_ntoa(bdaddr, NULL));
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -313,9 +309,8 @@ send_link_key_reply(int sock, struct sockaddr_bt *addr,
|
||||
|
||||
if (n < 0) {
|
||||
syslog(LOG_ERR, "Could not send link key reply to %s "
|
||||
"for remote bdaddr %s. %s (%d)",
|
||||
dev_name, bt_ntoa(bdaddr, NULL),
|
||||
strerror(errno), errno);
|
||||
"for remote bdaddr %s: %m",
|
||||
dev_name, bt_ntoa(bdaddr, NULL));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user