I can't even

This commit is contained in:
Alessandro Mauri 2023-02-19 23:40:58 +01:00
parent 805f633af0
commit dcce0ed11b
No known key found for this signature in database
GPG key ID: 2B7BF9531FF03BE8
11 changed files with 611 additions and 165 deletions

View file

@ -65,7 +65,7 @@ void map_file(const unsigned char **str, int *size, const char *path)
}
void dump_file(const char *path, unsigned char **buf, int *buf_len)
void dump_file(const char *path, char **buf, int *buf_len)
{
if (!path) {
errno = EINVAL;
@ -75,10 +75,9 @@ void dump_file(const char *path, unsigned char **buf, int *buf_len)
errno = EINVAL;
err(EXIT_FAILURE, "No buffer specified");
}
if (!buf_len) {
errno = EINVAL;
err(EXIT_FAILURE, "Nowhere to store buffer size");
}
int m = 0;
if (!buf_len)
buf_len = &m;
FILE *fp = fopen(path, "r");
if (!fp)
err(EXIT_FAILURE, "Cannot open file %s", path);