7d159a23c5775ffa925887ebfa93bb5dfa17f812
[openwrt/staging/stintel.git] / package / network / services / hostapd / patches / 701-reload_config_inline.patch
1 --- a/hostapd/config_file.c
2 +++ b/hostapd/config_file.c
3 @@ -5065,7 +5065,12 @@ struct hostapd_config * hostapd_config_r
4 int errors = 0;
5 size_t i;
6
7 - f = fopen(fname, "r");
8 + if (!strncmp(fname, "data:", 5)) {
9 + f = fmemopen((void *)(fname + 5), strlen(fname + 5), "r");
10 + fname = "<inline>";
11 + } else {
12 + f = fopen(fname, "r");
13 + }
14 if (f == NULL) {
15 wpa_printf(MSG_ERROR, "Could not open configuration file '%s' "
16 "for reading.", fname);
17 --- a/wpa_supplicant/config_file.c
18 +++ b/wpa_supplicant/config_file.c
19 @@ -326,8 +326,13 @@ struct wpa_config * wpa_config_read(cons
20 while (cred_tail && cred_tail->next)
21 cred_tail = cred_tail->next;
22
23 + if (!strncmp(name, "data:", 5)) {
24 + f = fmemopen((void *)(name + 5), strlen(name + 5), "r");
25 + name = "<inline>";
26 + } else {
27 + f = fopen(name, "r");
28 + }
29 wpa_printf(MSG_DEBUG, "Reading configuration file '%s'", name);
30 - f = fopen(name, "r");
31 if (f == NULL) {
32 wpa_printf(MSG_ERROR, "Failed to open config file '%s', "
33 "error: %s", name, strerror(errno));