mirror of
https://github.com/owntracks/recorder.git
synced 2024-11-15 18:08:28 -07:00
Merge pull request #243 from avanc/master
Deactivate warnings for format truncation
This commit is contained in:
commit
7a9dbc4292
2
Makefile
2
Makefile
@ -1,6 +1,6 @@
|
||||
include config.mk
|
||||
|
||||
CFLAGS +=-Wall -Werror
|
||||
CFLAGS +=-Wall -Werror
|
||||
LIBS = $(MORELIBS) -lm
|
||||
LIBS += -lcurl -lconfig
|
||||
|
||||
|
34
storage.c
34
storage.c
@ -49,9 +49,9 @@ void storage_init(int revgeo)
|
||||
setenv("TZ", "UTC", 1);
|
||||
|
||||
if (revgeo) {
|
||||
char path[BUFSIZ];
|
||||
char path[BUFSIZ * 2];
|
||||
|
||||
snprintf(path, BUFSIZ, "%s/ghash", STORAGEDIR);
|
||||
snprintf(path, BUFSIZ * 2, "%s/ghash", STORAGEDIR);
|
||||
gc = gcache_open(path, NULL, TRUE);
|
||||
if (gc == NULL) {
|
||||
olog(LOG_ERR, "storage_init(): gc is NULL");
|
||||
@ -61,17 +61,17 @@ void storage_init(int revgeo)
|
||||
|
||||
void storage_gcache_dump(char *lmdbname)
|
||||
{
|
||||
char path[BUFSIZ];
|
||||
snprintf(path, BUFSIZ, "%s/ghash", STORAGEDIR);
|
||||
char path[BUFSIZ*2];
|
||||
snprintf(path, BUFSIZ*2, "%s/ghash", STORAGEDIR);
|
||||
|
||||
gcache_dump(path, lmdbname);
|
||||
}
|
||||
|
||||
void storage_gcache_load(char *lmdbname)
|
||||
{
|
||||
char path[BUFSIZ];
|
||||
char path[BUFSIZ*2];
|
||||
|
||||
snprintf(path, BUFSIZ, "%s/ghash", STORAGEDIR);
|
||||
snprintf(path, BUFSIZ*2, "%s/ghash", STORAGEDIR);
|
||||
gcache_load(path, lmdbname);
|
||||
}
|
||||
|
||||
@ -178,19 +178,19 @@ static void get_gw_data(char *username, char *device, JsonNode *last)
|
||||
|
||||
void append_card_to_object(JsonNode *obj, char *user, char *device)
|
||||
{
|
||||
char path[BUFSIZ], path1[BUFSIZ], *cardfile = NULL;
|
||||
char path[BUFSIZ*2], path1[BUFSIZ*2], *cardfile = NULL;
|
||||
JsonNode *card;
|
||||
|
||||
if (!user || !*user)
|
||||
return;
|
||||
|
||||
|
||||
snprintf(path, BUFSIZ, "%s/cards/%s/%s/%s-%s.json",
|
||||
snprintf(path, BUFSIZ*2, "%s/cards/%s/%s/%s-%s.json",
|
||||
STORAGEDIR, user, device, user, device);
|
||||
if (access(path, R_OK) == 0) {
|
||||
cardfile = path;
|
||||
} else {
|
||||
snprintf(path1, BUFSIZ, "%s/cards/%s/%s.json",
|
||||
snprintf(path1, BUFSIZ*2, "%s/cards/%s/%s.json",
|
||||
STORAGEDIR, user, user);
|
||||
|
||||
if (access(path1, R_OK) == 0) {
|
||||
@ -207,10 +207,10 @@ void append_card_to_object(JsonNode *obj, char *user, char *device)
|
||||
|
||||
void append_device_details(JsonNode *userlist, char *user, char *device)
|
||||
{
|
||||
char path[BUFSIZ];
|
||||
char path[BUFSIZ*2];
|
||||
JsonNode *node, *last;
|
||||
|
||||
snprintf(path, BUFSIZ, "%s/last/%s/%s/%s-%s.json",
|
||||
snprintf(path, BUFSIZ*2, "%s/last/%s/%s/%s-%s.json",
|
||||
STORAGEDIR, user, device, user, device);
|
||||
|
||||
last = json_mkobject();
|
||||
@ -233,7 +233,7 @@ void append_device_details(JsonNode *userlist, char *user, char *device)
|
||||
}
|
||||
|
||||
/* Extra data */
|
||||
snprintf(path, BUFSIZ, "%s/last/%s/%s/extra.json",
|
||||
snprintf(path, BUFSIZ*2, "%s/last/%s/%s/extra.json",
|
||||
STORAGEDIR, user, device);
|
||||
json_copy_from_file(last, path);
|
||||
#if WITH_GREENWICH
|
||||
@ -253,9 +253,9 @@ JsonNode *last_users(char *in_user, char *in_device, JsonNode *fields)
|
||||
{
|
||||
JsonNode *obj = json_mkobject();
|
||||
JsonNode *un, *dn, *userlist = json_mkarray();
|
||||
char path[BUFSIZ], user[BUFSIZ], device[BUFSIZ];
|
||||
char path[BUFSIZ*2], user[BUFSIZ], device[BUFSIZ];
|
||||
|
||||
snprintf(path, BUFSIZ, "%s/last", STORAGEDIR);
|
||||
snprintf(path, BUFSIZ*2, "%s/last", STORAGEDIR);
|
||||
|
||||
// fprintf(stderr, "last_users(%s, %s)\n", (in_user) ? in_user : "<nil>",
|
||||
// (in_device) ? in_device : "<nil>");
|
||||
@ -1481,7 +1481,7 @@ void csv_output(JsonNode *array, output_type otype, JsonNode *fields, void (*fun
|
||||
|
||||
char *storage_userphoto(char *username)
|
||||
{
|
||||
static char path[BUFSIZ];
|
||||
static char path[BUFSIZ*2];
|
||||
|
||||
if (!username || !*username)
|
||||
return (NULL);
|
||||
@ -1498,7 +1498,7 @@ char *storage_userphoto(char *username)
|
||||
|
||||
void extra_http_json(JsonNode *array, char *user, char *device)
|
||||
{
|
||||
char path[BUFSIZ], *js_string;
|
||||
char path[BUFSIZ*2], *js_string;
|
||||
JsonNode *node;
|
||||
|
||||
if (!array || !user || !*user || !device || !*device)
|
||||
@ -1507,7 +1507,7 @@ void extra_http_json(JsonNode *array, char *user, char *device)
|
||||
return;
|
||||
|
||||
/* Extra data */
|
||||
snprintf(path, BUFSIZ, "%s/last/%s/%s/http.json",
|
||||
snprintf(path, BUFSIZ*2, "%s/last/%s/%s/http.json",
|
||||
STORAGEDIR, user, device);
|
||||
|
||||
if ((js_string = slurp_file(path, TRUE)) == NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user