static void ss_listener_event_func(int _fd, unsigned ev, void *_l)
{
asocket *s;
+ int ret = -1;
if(ev & FDE_READ) {
struct sockaddr addr;
fd = sdb_socket_accept(_fd, &addr, &alen);
if(fd < 0) return;
- sdb_socket_setbufsize(fd, CHUNK_SIZE);
+ ret = sdb_socket_setbufsize(fd, CHUNK_SIZE);
+ if (ret == -1) {
+ D("sdbd: sdb_socket_setbufsize failed \n", ret);
+ }
s = create_local_socket(fd);
if(s) {
int group_match = 0;
int added_group_cnt = 0;
- getgrouplist(name, gid, NULL, &ngroups);
- D("group list : ngroups = %d\n", ngroups);
+ if (getgrouplist(name, gid, NULL, &ngroups) == -1) {
+ D("group list : ngroups = %d\n", ngroups);
+ }
group_ids = malloc((ngroups + default_groups_size) * sizeof(gid_t));
if (group_ids == NULL) {
E("failed to allocate group_ids(%zu)\n", (ngroups + default_groups_size) * sizeof(gid_t));
static void redirect_and_exec(int pts, const char *cmd, char * const argv[], char * const envp[])
{
+ if(argv == NULL) {
+ fprintf(stderr, "sdbu argv is NULL\n");
+ return;
+ }
dup2(pts, 0);
dup2(pts, 1);
dup2(pts, 2);
static __inline__ void disable_tcp_nagle(int fd)
{
int on = 1;
- setsockopt( fd, IPPROTO_TCP, TCP_NODELAY, (void*)&on, sizeof(on) );
+ int ret = -1;
+ ret = setsockopt( fd, IPPROTO_TCP, TCP_NODELAY, (void*)&on, sizeof(on) );
+ if (ret == -1) {
+ fprintf(stderr, "sdbd: setsockopt failed \n", errno);
+ return;
+ }
}