summaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c48
1 files changed, 9 insertions, 39 deletions
diff --git a/src/utils.c b/src/utils.c
index a61ca1c..ed3eea5 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -1,22 +1,22 @@
/*
- * rhdropbox
+ * dropnroll
*
- * Copyright (C) 2009 Christian Pointner <equinox@helsinki.at>
+ * Copyright (C) 2009-2015 Christian Pointner <equinox@spreadspace.org>
*
- * This file is part of rhdropbox.
+ * This file is part of dropnroll.
*
- * rhdropbox is free software: you can redistribute it and/or modify
+ * dropnroll is free software: you can redistribute it and/or modify
* 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.
*
- * rhdropbox is distributed in the hope that it will be useful,
+ * dropnroll is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with rhdropbox. If not, see <http://www.gnu.org/licenses/>.
+ * along with dropnroll. If not, see <http://www.gnu.org/licenses/>.
*/
#include "datatypes.h"
@@ -53,7 +53,7 @@ int init_command_socket(const char* path)
log_printf(ERROR, "unable to bind to '%s': %s", local.sun_path, strerror(errno));
return -1;
}
-
+
ret = listen(fd, 4);
if(ret) {
log_printf(ERROR, "unable to listen on command socket: %s", local.sun_path, strerror(errno));
@@ -61,7 +61,7 @@ int init_command_socket(const char* path)
}
log_printf(INFO, "now listening on %s for incoming commands", path);
-
+
return fd;
}
@@ -111,36 +111,6 @@ int send_string(int fd, const char* string)
return ret;
}
-int nonblock_recvline(read_buffer_t* buffer, int fd, int inotify_fd, watch_list_t* watch_lst, client_t* client_lst, options_t* opt)
-{
- int ret = 0;
- for(;;) {
- ret = recv(fd, &buffer->buf[buffer->offset], 1, 0);
- if(!ret)
- return 2;
- if(ret == -1 && errno == EAGAIN)
- return 0;
- else if(ret < 0)
- return 2;
-
- if(buffer->buf[buffer->offset] == '\n') {
- buffer->buf[buffer->offset] = 0;
- ret = process_cmd(buffer->buf, fd, inotify_fd, watch_lst, client_lst, opt);
- buffer->offset = 0;
- break;
- }
-
- buffer->offset++;
- if(buffer->offset >= sizeof(buffer->buf)) {
- log_printf(DEBUG, "string too long (fd=%d)", fd);
- buffer->offset = 0;
- return 0;
- }
- }
-
- return ret;
-}
-
int create_inotify()
{
int fd = inotify_init();
@@ -148,7 +118,7 @@ int create_inotify()
log_printf(ERROR, "error at inotify_init: %s", strerror(errno));
return -1;
}
-
+
int fs_flags = fcntl(fd, F_GETFL);
if(fs_flags == -1) {
log_printf(ERROR, "inotify init failed (fcntl read flags error: %s)", strerror(errno));