moved raspberry and router gpio to pi_as_powerwitch on github
[svn42.git] / door_daemon / door_daemon.c
index ee93657..bddb28f 100644 (file)
@@ -6,8 +6,9 @@
  *  This file is part of door_daemon.
  *
  *  door_daemon is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 3 as
- *  published by the Free Software Foundation.
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  any later version.
  *
  *  door_daemon is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -110,7 +111,7 @@ int send_response(int fd, const char* response)
   int offset = 0;
   int ret;
   for(;;) {
-    ret = write(fd, &response[offset], strlen(response));
+    ret = write(fd, &response[offset], len - offset);
     if(ret < 0) {
       if(errno != EINTR)
         return ret;
@@ -430,7 +431,8 @@ int main_loop(int door_fd, int cmd_listen_fd)
           break;
 
       }
-      lst = lst->next;
+      if(lst)
+        lst = lst->next;
     }
 
     if(cmd_q && !cmd_q->sent)