summaryrefslogtreecommitdiff
path: root/hidd
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2006-07-26 13:32:44 +0000
committerMarcel Holtmann <marcel@holtmann.org>2006-07-26 13:32:44 +0000
commitb102348e988e4abc5d579ce13c067ce2c885aaf7 (patch)
treef7df67ce818aa8720f956171765889684c528ee1 /hidd
parentabaf87668c896d8cebcfa1081eec195cd0008740 (diff)
Fix declared with attribute warn_unused_result errors
Diffstat (limited to 'hidd')
-rw-r--r--hidd/fakehid.c3
-rw-r--r--hidd/main.c21
2 files changed, 10 insertions, 14 deletions
diff --git a/hidd/fakehid.c b/hidd/fakehid.c
index 0d87335b2..138d2b482 100644
--- a/hidd/fakehid.c
+++ b/hidd/fakehid.c
@@ -47,6 +47,7 @@
static void event(int fd, uint16_t type, uint16_t code, int32_t value)
{
struct uinput_event event;
+ int len;
if (fd <= fileno(stderr))
return;
@@ -56,7 +57,7 @@ static void event(int fd, uint16_t type, uint16_t code, int32_t value)
event.code = code;
event.value = value;
- write(fd, &event, sizeof(event));
+ len = write(fd, &event, sizeof(event));
}
static void func(int fd)
diff --git a/hidd/main.c b/hidd/main.c
index 6ccbf0bce..b684cac7b 100644
--- a/hidd/main.c
+++ b/hidd/main.c
@@ -638,8 +638,8 @@ int main(int argc, char *argv[])
uint8_t subclass = 0x00;
char addr[18];
int log_option = LOG_NDELAY | LOG_PID;
- int opt, fd, ctl, csk, isk;
- int mode = SHOW, daemon = 1, nosdp = 0, nocheck = 0, bootonly = 0;
+ int opt, ctl, csk, isk;
+ int mode = SHOW, detach = 1, nosdp = 0, nocheck = 0, bootonly = 0;
int fakehid = 1, encrypt = 0, timeout = 30, lm = 0;
bacpy(&bdaddr, BDADDR_ANY);
@@ -653,7 +653,7 @@ int main(int argc, char *argv[])
str2ba(optarg, &bdaddr);
break;
case 'n':
- daemon = 0;
+ detach = 0;
break;
case 't':
timeout = atoi(optarg);
@@ -760,16 +760,11 @@ int main(int argc, char *argv[])
exit(0);
}
- if (daemon) {
- if (fork())
- exit(0);
-
- fd = open("/dev/null", O_RDWR);
- dup2(fd, 0); dup2(fd, 1); dup2(fd, 2);
- close(fd);
-
- setsid();
- chdir("/");
+ if (detach) {
+ if (daemon(0, 0)) {
+ perror("Can't start daemon");
+ exit(1);
+ }
} else
log_option |= LOG_PERROR;