2 Commits

Author SHA1 Message Date
f1162e4df1 fix 2026-05-25 11:49:36 +03:00
850002d800 little fix 2026-05-20 10:01:47 +03:00
2 changed files with 6 additions and 4 deletions

View File

@@ -140,9 +140,11 @@ int sl_daemonize(){
close(STDIN_FILENO); close(STDIN_FILENO);
close(STDOUT_FILENO); close(STDOUT_FILENO);
close(STDERR_FILENO); close(STDERR_FILENO);
if(open("/dev/null", O_RDWR) < 0) return -1; int ofd = open("/dev/null", O_RDWR);
if(dup(0) < 0) return -1; if(ofd < 0) return -1;
if(dup(0) < 0) return -1; if(dup(ofd) < 0) return -1; // STDIN
if(dup(ofd) < 0) return -1; // STDOUT
if(dup(ofd) < 0) return -1; // STDERR
if(SIG_ERR == signal(SIGHUP, SIG_IGN)) return -1; if(SIG_ERR == signal(SIGHUP, SIG_IGN)) return -1;
return 0; return 0;
} }

View File

@@ -738,7 +738,7 @@ int sl_sock_open(sl_socktype_e type, const char *path, int isserver, int ai_sock
} }
}else{ }else{
if(connect(sock, p->ai_addr, p->ai_addrlen) == -1){ if(connect(sock, p->ai_addr, p->ai_addrlen) == -1){
WARN("connect()"); //WARN("connect()");
close(sock); sock = -1; close(sock); sock = -1;
continue; continue;
} }