fix: check payload fd
This commit is contained in:
parent
fa004f3a6a
commit
f83b053fcb
Binary file not shown.
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue