forked from poz/modfetch
Merge pull request 'master' (#1) from jacekpoz/modfetch:master into master
Reviewed-on: #1
This commit is contained in:
commit
9361c68611
1 changed files with 7 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -109,6 +110,7 @@ char *resolve_env_vars(const char *str) {
|
||||||
ret[ret_offset] = str[i];
|
ret[ret_offset] = str[i];
|
||||||
ret_offset += 1;
|
ret_offset += 1;
|
||||||
}
|
}
|
||||||
|
ret[ret_offset] = '\0';
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -140,6 +142,9 @@ Config parse_config(FILE *config_file) {
|
||||||
.module_count = 0,
|
.module_count = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO handle errors of all the function inside the while
|
||||||
|
errno = 0;
|
||||||
|
|
||||||
// TODO rewrite this to read the config char by char
|
// TODO rewrite this to read the config char by char
|
||||||
while ((read = getline(&line, &len, config_file)) != -1) {
|
while ((read = getline(&line, &len, config_file)) != -1) {
|
||||||
if (read <= 1)
|
if (read <= 1)
|
||||||
|
@ -200,6 +205,8 @@ Config parse_config(FILE *config_file) {
|
||||||
|
|
||||||
free(line);
|
free(line);
|
||||||
}
|
}
|
||||||
|
if (read == -1 && errno != 0)
|
||||||
|
free(line);
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue