aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_save_to_bmp.c
diff options
context:
space:
mode:
authorsalaaad2 <arthurdurant263@gmail.com>2020-03-11 18:59:58 +0100
committersalaaad2 <arthurdurant263@gmail.com>2020-03-11 18:59:58 +0100
commitb6388b5101d8187f746f91c89842e932a1d01cb6 (patch)
tree70bd9ba7012f5906db01b485ec8f58f5a4697240 /src/ft_save_to_bmp.c
parentclose but no cigar (diff)
parentca tue (diff)
download42-cub3d-b6388b5101d8187f746f91c89842e932a1d01cb6.tar.gz
42-cub3d-b6388b5101d8187f746f91c89842e932a1d01cb6.tar.bz2
42-cub3d-b6388b5101d8187f746f91c89842e932a1d01cb6.tar.xz
42-cub3d-b6388b5101d8187f746f91c89842e932a1d01cb6.tar.zst
42-cub3d-b6388b5101d8187f746f91c89842e932a1d01cb6.zip
get merged
Diffstat (limited to '')
-rw-r--r--src/ft_save_to_bmp.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ft_save_to_bmp.c b/src/ft_save_to_bmp.c
index 90bbb1f..ae3a2b6 100644
--- a/src/ft_save_to_bmp.c
+++ b/src/ft_save_to_bmp.c
@@ -93,9 +93,10 @@ static int8_t
bmp_info.size_image = size;
if (!(fd = open(fname, O_RDWR | O_CREAT, 0644)))
return (-1);
- write(fd, &bmp_file, sizeof(t_bmp_file));
- write(fd, &bmp_info, sizeof(t_bmp_info));
- write(fd, bmp, size);
+ if (!write(fd, &bmp_file, sizeof(t_bmp_file)) ||
+ !write(fd, &bmp_info, sizeof(t_bmp_info)) ||
+ !write(fd, bmp, size))
+ return (-1);
close(fd);
return (0);
}