struct sockaddr_un local;
local.sun_family = AF_UNIX;
- strcpy(local.sun_path, path); // TODO: strlen ???
+ if(sizeof(local.sun_path) <= strlen(path)) {
+ log_printf(ERROR, "socket path is to long (max %d)", sizeof(local.sun_path)-1);
+ return -1;
+ }
+ strcpy(local.sun_path, path);
unlink(local.sun_path);
int len = SUN_LEN(&local);
int ret = bind(fd, (struct sockaddr*)&local, len);
static char buffer[100];
int ret = 0;
- do { // TODO: replace this whith a actually working readline
+ do { // TODO: replace this whith a actually working non-blocking-readline
memset(buffer, 0, 100);
ret = recv(fd, buffer, sizeof(buffer), 0);
if(!ret)
static char buffer[100];
int ret = 0;
- do { // TODO: replace this whith a actually working readline
+ do { // TODO: replace this whith a actually working non-blocking-readline
memset(buffer, 0, 100);
ret = read(door_fd, buffer, sizeof(buffer));
if(!ret)