42-archive/libftasm/srcs/sys/dup2_close.c
2017-03-31 21:42:02 +02:00

22 lines
1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* dup2_close.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/07 16:07:28 by jhalford #+# #+# */
/* Updated: 2017/03/24 19:33:48 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int dup2_close(int fd1, int fd2)
{
if (dup2(fd1, fd2) < 0)
return (-1);
if (close(fd1) < 0)
return (-1);
return (0);
}