diff options
Diffstat (limited to 'src/ft_save_to_bmp.c')
-rw-r--r-- | src/ft_save_to_bmp.c | 7 |
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); } |