mirror of
https://github.com/owntracks/recorder.git
synced 2026-08-23 11:26:16 +00:00
Merge pull request #296 from tabacha/fix_unsued_result_warning
fix unused result warning on debian stretch, fixes #290
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
#include "geohash.h"
|
||||
#include "udata.h"
|
||||
#include "version.h"
|
||||
#include <float.h>
|
||||
#ifdef WITH_HTTP
|
||||
# include "http.h"
|
||||
#endif
|
||||
@@ -288,7 +289,8 @@ static void send_last(struct mg_connection *conn)
|
||||
JsonNode *user_array, *o, *one;
|
||||
char *u = NULL, *d = NULL, *ghash;
|
||||
double lat, lon;
|
||||
|
||||
lat = DBL_MAX;
|
||||
lon = DBL_MAX;
|
||||
u = field(conn, "user");
|
||||
d = field(conn, "device");
|
||||
|
||||
@@ -334,10 +336,10 @@ static void send_last(struct mg_connection *conn)
|
||||
if ((f = json_find_member(one, "topic")) != NULL)
|
||||
json_copy_element_to_object(o, "topic", f);
|
||||
|
||||
if ((ghash = geohash_encode(lat, lon, geohash_prec())) != NULL) {
|
||||
if ((ghash = geohash_encode(lat, lon, geohash_prec())) != NULL) {
|
||||
json_append_member(o, "ghash", json_mkstring(ghash));
|
||||
free(ghash);
|
||||
}
|
||||
}
|
||||
|
||||
http_ws_push_json(ud->mgserver, o);
|
||||
json_delete(o);
|
||||
@@ -1586,4 +1588,3 @@ int ev_handler(struct mg_connection *conn, enum mg_event ev)
|
||||
}
|
||||
|
||||
#endif /* WITH_HTTP */
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#pragma GCC diagnostic ignored "-Wunused-result"
|
||||
// Copyright (c) 2004-2013 Sergey Lyubka <valenok@gmail.com>
|
||||
// Copyright (c) 2013-2014 Cesanta Software Limited
|
||||
// All rights reserved
|
||||
|
||||
@@ -535,7 +535,9 @@ int safewrite(char *filename, char *buf)
|
||||
}
|
||||
/* Ensure NL-terminated */
|
||||
if (buf[strlen(buf) - 1] != '\n') {
|
||||
write(fd, "\n", 1);
|
||||
if (write(fd, "\n", 1) != 1) {
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
close(fd);
|
||||
@@ -595,7 +597,7 @@ double haversine_dist(double th1, double ph1, double th2, double ph2)
|
||||
void chomp(char *s)
|
||||
{
|
||||
char *p;
|
||||
|
||||
|
||||
if (!s || *s == 0)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user