Update JSON parsing for backwards compatibility
The latest stable release for debian ships with libjson-c 0.12, which doesn't contain the json_pointer.h file. This change should hopefully work for version 0.13.x as well.
This commit is contained in:
parent
3e67cd240b
commit
4c66331cf9
1 changed files with 1 additions and 2 deletions
|
@ -21,7 +21,6 @@
|
|||
#include <curl/curl.h>
|
||||
#include <json-c/json_object.h>
|
||||
#include <json-c/json_tokener.h>
|
||||
#include <json-c/json_pointer.h>
|
||||
#include "config.h"
|
||||
#include "log.h"
|
||||
#include "network.h"
|
||||
|
@ -155,7 +154,7 @@ static int parse_status(char * raw_json) {
|
|||
write_log(PIHELPER_LOG_DEBUG, "%s", json_object_to_json_string_ext(jobj, JSON_C_TO_STRING_PRETTY));
|
||||
json_object *status;
|
||||
const char * status_string;
|
||||
if (json_pointer_get(jobj, "/status", &status) == 0
|
||||
if (json_object_object_get_ex(jobj, "/status", &status) == 0
|
||||
&& (status_string = json_object_get_string(status)) != NULL) {
|
||||
if (strstr(status_string, "enabled") == status_string) {
|
||||
retval = PIHELPER_ENABLED;
|
||||
|
|
Loading…
Reference in a new issue