X-Git-Url: https://git.realraum.at/?p=svn42.git;a=blobdiff_plain;f=door_daemon%2Fdoor_daemon.c;h=bddb28fc371209019d2a80421d47bed46718db1f;hp=ed0fbc0c2395ebc2de726c2a3ba3d0cc69476d8f;hb=4ee2501ff864b8e15202ee814e8bafcc0c2adf6c;hpb=79dc6684a7328fa07f7df0cd4bcd2df7da06b61b diff --git a/door_daemon/door_daemon.c b/door_daemon/door_daemon.c index ed0fbc0..bddb28f 100644 --- a/door_daemon/door_daemon.c +++ b/door_daemon/door_daemon.c @@ -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; @@ -177,7 +178,7 @@ int process_cmd(const char* cmd, int fd, cmd_t **cmd_q, client_t* client_lst) listener_cnt++; } free(resp); - log_printf(DEBUG, "sent request to %d listeners", listener_cnt); + log_printf(DEBUG, "sent request to %d additional listeners", listener_cnt); } // else silently ignore memory alloc error } @@ -311,7 +312,7 @@ int process_door(read_buffer_t* buffer, int door_fd, cmd_t **cmd_q, client_t* cl send_response(client->fd, buffer->buf); listener_cnt++; } - log_printf(DEBUG, "sent status to %d listeners", listener_cnt); + log_printf(DEBUG, "sent status to %d additional listeners", listener_cnt); } if(!strncmp(buffer->buf, "Error:", 6)) { @@ -322,7 +323,7 @@ int process_door(read_buffer_t* buffer, int door_fd, cmd_t **cmd_q, client_t* cl send_response(client->fd, buffer->buf); listener_cnt++; } - log_printf(DEBUG, "sent error to %d listeners", listener_cnt); + log_printf(DEBUG, "sent error to %d additional listeners", listener_cnt); } cmd_pop(cmd_q); @@ -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)