| 1 |
/* |
| 2 |
* HEADER Testing read_config() |
| 3 |
*/ |
| 4 |
|
| 5 |
static const unsigned char data[] = { 0xff, 0x20, 0xff }; |
| 6 |
char *path; |
| 7 |
FILE *f; |
| 8 |
int res; |
| 9 |
|
| 10 |
register_mib_handlers(); |
| 11 |
|
| 12 |
res = asprintf(&path, "/tmp/read-config-input-%d", getpid()); |
| 13 |
OKF(res >= 0, ("asprintf() returned %d", res)); |
| 14 |
f = fopen(path, "wb"); |
| 15 |
OKF(f != NULL, ("fopen() %s", f ? "succeeded" : "failed")); |
| 16 |
res = fwrite(data, sizeof(data), 1, f); |
| 17 |
OKF(res == 1, ("fwrite() %s", res == 1 ? "succeeded" : "failed")); |
| 18 |
fclose(f); |
| 19 |
read_config(path, read_config_get_handlers("snmp"), 0); |
| 20 |
unlink(path); |
| 21 |
free(path); |