fix: check payload fd

This commit is contained in:
gbrochar 2024-04-09 10:28:35 +02:00
parent fa004f3a6a
commit f83b053fcb
2 changed files with 6 additions and 1 deletions

BIN
srcs/.woody.c.swp Normal file

Binary file not shown.

View File

@ -87,6 +87,11 @@ t_payload *get_payload()
return NULL;
char buffer[1024];
int fd = open("payload", O_RDONLY);
if (fd == -1) {
perror("error opening payload");
free(payload);
exit(1);
}
payload->len = read(fd, buffer, 1024);
payload->payload = malloc(sizeof(char) * payload->len);
ft_memcpy(payload->payload, buffer, payload->len);