remove forbidden function fcntl, add early stop for errors during parsing, remove debug print

This commit is contained in:
2025-08-08 22:33:12 +02:00
parent 0eb1e9055d
commit 43e47f89aa
3 changed files with 8 additions and 7 deletions

View File

@ -6,7 +6,7 @@
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/24 00:03:56 by tomoron #+# #+# */
/* Updated: 2025/05/02 00:51:39 by tomoron ### ########.fr */
/* Updated: 2025/08/08 22:30:18 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -33,7 +33,6 @@ int init_socket(char *name)
fprintf(stderr, "%s: can't initialize socket\n", name);
return(-1);
}
fcntl(res, F_SETFL, O_NONBLOCK);
return(res);
}
@ -60,12 +59,15 @@ int main(int argc, char **argv)
t_settings settings;
settings = parse_args(argc, argv);
if(settings.stop)
goto early_stop;
settings.socket = init_socket(argv[0]);
settings.id = get_id();
settings.name = argv[0];
signal(SIGINT, signal_handler);
if(settings.stop || settings.err || settings.socket == -1)
{
early_stop:
free_hosts(settings.hosts);
return((settings.err != 0) * 64);
}