Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple compilation fixes and one bugfix #11

Merged
merged 4 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion coreutils/condmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ int condmv_main(int argc, char *argv[])
rebased_from, strerror(errno));
goto err;
}
if (fprintf(file, "%s %lu %s\n", opt_add, mytime, from) < 0)
if (fprintf(file, "%s %llu %s\n", opt_add,
(unsigned long long)mytime, from) < 0)
{
fprintf(stderr,
"condmv: unable to append to '%s': %s\n",
Expand Down
7 changes: 4 additions & 3 deletions eperd/condmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ static void condmv_start(void *state)

len= strlen(condmvstate->to) + 20;
to= malloc(len);
snprintf(to, len, "%s.%ld", condmvstate->to,
(long)time(NULL)/condmvstate->interval);
snprintf(to, len, "%s.%llu", condmvstate->to,
(unsigned long long)time(NULL)/condmvstate->interval);

crondlog(LVL7 "condmv_start: destination '%s'\n", to);

Expand All @@ -124,7 +124,8 @@ static void condmv_start(void *state)
free(to);
return;
}
if (fprintf(file, "%s %lu %s\n", condmvstate->atlas, mytime,
if (fprintf(file, "%s %llu %s\n", condmvstate->atlas,
(unsigned long long)mytime,
condmvstate->from) < 0)
{
crondlog(LVL9 "condmv: unable to append to '%s': %s\n",
Expand Down
25 changes: 13 additions & 12 deletions eperd/evtdig.c
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ static int mk_dns_buff(struct query_state *qry, u_char *packet,
lookup_prepend = xzalloc(DEFAULT_LINE_LENGTH + sizeof(qry->lookupname));
snprintf(lookup_prepend, (sizeof(qry->lookupname) +
DEFAULT_LINE_LENGTH - 1),
"%d.%lu.%s", probe_id, qry->xmit_time,
"%d.%llu.%s", probe_id, (unsigned long long)qry->xmit_time,
qry->lookupname);

qnamelen= ChangetoDnsNameFormat(qname, qnamelen,
Expand Down Expand Up @@ -1612,7 +1612,8 @@ static void tcp_connected(struct tu_env *env, struct bufferevent *bev)
}
else
{
getsockname(bufferevent_getfd(bev), &qry->loc_sin6, &qry->loc_socklen);
getsockname(bufferevent_getfd(bev),
(struct sockaddr *)&qry->loc_sin6, &qry->loc_socklen);
if (qry->response_out)
{
write_response(qry->resp_file, RESP_SOCKNAME,
Expand Down Expand Up @@ -3081,7 +3082,7 @@ static void tdig_stats(int unusg_statsed UNUSED_PARAM, const short event UNUSED_
AS(atlas_get_version_json_str());
AS(", ");
gettimeofday(&now, NULL);
JS1(time, %ld, now.tv_sec);
JS1(time, %llu, (unsigned long long)now.tv_sec);
JU(sok , base->sentok);
JU(rok , base->recvok);
JU(sent , base->sentbytes);
Expand Down Expand Up @@ -3395,7 +3396,7 @@ void printErrorQuick (struct query_state *qry)
fprintf(fh, "RESULT { ");
fprintf(fh, "%s,", atlas_get_version_json_str());
fprintf(fh, "\"id\" : 9202 ,");
fprintf(fh, "\"time\" : %ld ,", atlas_time());
fprintf(fh, "\"time\" : %llu ,", (unsigned long long)atlas_time());

fprintf(fh, "\"error\" : [{ ");
fprintf(fh, "\"query busy\": \"not starting a new one. previous one is not done yet\"}");
Expand All @@ -3405,7 +3406,7 @@ void printErrorQuick (struct query_state *qry)
fprintf(fh, "\"id\" : \"%s\"", qry->str_Atlas);
if (qry->str_bundle)
fprintf(fh, ",\"bundle\" : %s", qry->str_bundle);
fprintf(fh, ",\"start time\" : %ld", qry->xmit_time);
fprintf(fh, ",\"start time\" : %llu", (unsigned long long)qry->xmit_time);
if(qry->retry) {
fprintf(fh, ",\"retry\": %d", qry->retry);

Expand Down Expand Up @@ -3456,7 +3457,7 @@ void printReply(struct query_state *qry, int wire_size, unsigned char *result)
AS(atlas_get_version_json_str());
AS(", ");
if (qry->opt_rset){
JS1(time, %ld, qry->xmit_time);
JS1(time, %llu, (unsigned long long)qry->xmit_time);
JD(lts,lts);
AS("\"resultset\" : [ {");
}
Expand All @@ -3466,7 +3467,7 @@ void printReply(struct query_state *qry, int wire_size, unsigned char *result)
AS (",{");
}

JS1(time, %ld, qry->xmit_time);
JS1(time, %llu, (unsigned long long)qry->xmit_time);
JD(lts,lts);

if (qry->opt_do_tls && ssl_version != NULL)
Expand Down Expand Up @@ -3791,7 +3792,7 @@ unsigned char* ReadName(unsigned char *base, size_t size, size_t offset,
/* Bad format */
snprintf((char *)name, sizeof(name),
"format-error at %lu: value 0x%x",
offset, len);
(unsigned long)offset, len);
*count= -1;
free(name); name= NULL;
return name;
Expand All @@ -3802,7 +3803,7 @@ unsigned char* ReadName(unsigned char *base, size_t size, size_t offset,
{
snprintf((char *)name, sizeof(name),
"offset-error at %lu: offset %lu",
offset, noffset);
(unsigned long)offset, (unsigned long)noffset);
*count= -1;
free(name); name= NULL;
return name;
Expand All @@ -3813,7 +3814,7 @@ unsigned char* ReadName(unsigned char *base, size_t size, size_t offset,
/* Too many */
snprintf((char *)name, sizeof(name),
"too many redirects at %lu",
offset);
(unsigned long)offset);
*count= -1;
free(name); name= NULL;
return name;
Expand All @@ -3835,7 +3836,7 @@ unsigned char* ReadName(unsigned char *base, size_t size, size_t offset,
{
snprintf((char *)name, sizeof(name),
"buf-bounds-error at %lu: len %d",
offset, len);
(unsigned long)offset, len);
*count= -1;
free(name); name= NULL;
return name;
Expand All @@ -3845,7 +3846,7 @@ unsigned char* ReadName(unsigned char *base, size_t size, size_t offset,
{
snprintf((char *)name, sizeof(name),
"name-length-error at %lu: len %d",
offset, p+len+1);
(unsigned long)offset, p+len+1);
*count= -1;
free(name); name= NULL;
return name;
Expand Down
11 changes: 6 additions & 5 deletions eperd/httpget.c
Original file line number Diff line number Diff line change
Expand Up @@ -853,10 +853,10 @@ static void report(struct hgstate *state)
fprintf(fh, DBQ(id) ":" DBQ(%s) ", "
"%s, "
DBQ(lts) ":%d, "
DBQ(time) ":%ld, ",
DBQ(time) ":%llu, ",
state->atlas, atlas_get_version_json_str(),
get_timesync(),
state->gstart);
(unsigned long long)state->gstart);
if (state->bundle)
{
fprintf(fh, DBQ(bundle) ":%s, ",
Expand All @@ -876,8 +876,8 @@ static void report(struct hgstate *state)
{
if (state->do_combine)
{
snprintf(line, sizeof(line), DBQ(time) ":%ld, ",
state->start.tv_sec);
snprintf(line, sizeof(line), DBQ(time) ":%llu, ",
(unsigned long long)state->start.tv_sec);
}
else
{
Expand Down Expand Up @@ -2103,7 +2103,8 @@ static void connected(struct tu_env *env, struct bufferevent *bev)
else
{
getsockname(bufferevent_getfd(bev),
&state->loc_sin6, &state->loc_socklen);
(struct sockaddr *)&state->loc_sin6,
&state->loc_socklen);
if (state->response_out)
{
write_response(state->resp_file, RESP_SOCKNAME,
Expand Down
8 changes: 4 additions & 4 deletions eperd/ntp.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,10 @@ static void report(struct ntpstate *state)
fprintf(fh, DBQ(id) ":" DBQ(%s)
", %s"
", " DBQ(lts) ":%d"
", " DBQ(time) ":%ld, ",
", " DBQ(time) ":%llu, ",
state->atlas, atlas_get_version_json_str(),
get_timesync(),
state->starttime);
(unsigned long long)state->starttime);
if (state->bundle)
fprintf(fh, DBQ(bundle) ":%s, ", state->bundle);
}
Expand Down Expand Up @@ -1218,13 +1218,13 @@ static int create_socket(struct ntpstate *state)

len= sizeof(state->loc_sin6);
read_response(state->socket, RESP_SOCKNAME,
&len, &state->loc_sin6);
&len, (struct sockaddr *)&state->loc_sin6);
state->loc_socklen= len;
}
else
{
if (getsockname(state->socket,
&state->loc_sin6,
(struct sockaddr*)&state->loc_sin6,
&state->loc_socklen) == -1)
{
crondlog(DIE9 "getsockname failed");
Expand Down
12 changes: 8 additions & 4 deletions eperd/ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,8 @@ static void ping_xmit(struct pingstate *host)
}
else
{
getsockname(host->socket, &host->loc_sin6,
getsockname(host->socket,
(struct sockaddr *)&host->loc_sin6,
&host->loc_socklen);
if (host->resp_file_out)
{
Expand Down Expand Up @@ -735,7 +736,8 @@ static void ping_xmit(struct pingstate *host)
host->include_probe_id);

host->loc_socklen= sizeof(host->loc_sin6);
getsockname(host->socket, &host->loc_sin6, &host->loc_socklen);
getsockname(host->socket, (struct sockaddr *)&host->loc_sin6,
&host->loc_socklen);

if (host->response_in)
{
Expand Down Expand Up @@ -1567,7 +1569,8 @@ static void ping_start2(void *state)
}

if (!pingstate->response_in &&
connect(pingstate->socket, &pingstate->sin6,
connect(pingstate->socket,
(struct sockaddr *)&pingstate->sin6,
pingstate->socklen) == -1)
{
snprintf(line, sizeof(line),
Expand All @@ -1592,7 +1595,8 @@ static void ping_start2(void *state)
}
else
{
getsockname(pingstate->socket, &pingstate->loc_sin6,
getsockname(pingstate->socket,
(struct sockaddr *)&pingstate->loc_sin6,
&pingstate->loc_socklen);
if (pingstate->resp_file_out)
{
Expand Down
13 changes: 7 additions & 6 deletions eperd/sslgetcert.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ static void buf_add(struct buf *buf, const void *data, size_t len)
newbuf= malloc(maxsize);
if (!newbuf)
{
fprintf(stderr, "unable to allocate %ld bytes\n", maxsize);
fprintf(stderr, "unable to allocate %ld bytes\n", (long)maxsize);
exit(1);
}

Expand Down Expand Up @@ -1026,9 +1026,9 @@ static void report(struct state *state)
fprintf(fh, DBQ(id) ":" DBQ(%s) ", "
"%s, "
DBQ(lts) ":%d, "
DBQ(time) ":%ld, ",
DBQ(time) ":%llu, ",
state->atlas, atlas_get_version_json_str(),
get_timesync(), state->gstart);
get_timesync(), (unsigned long long)state->gstart);
if (state->bundle)
fprintf(fh, DBQ(bundle) ":%s, ", state->bundle);
}
Expand Down Expand Up @@ -1185,8 +1185,8 @@ static FILE *report_head(struct state *state)
fprintf(fh, DBQ(bundle) ":%s, ", state->bundle);
}

fprintf(fh, "%s" DBQ(time) ":%ld",
state->atlas ? ", " : "", atlas_time());
fprintf(fh, "%s" DBQ(time) ":%llu",
state->atlas ? ", " : "", (unsigned long long)atlas_time());
fprintf(fh, ", " DBQ(dst_name) ":" DBQ(%s) ", "
DBQ(dst_port) ":" DBQ(%s),
state->hostname, state->portname);
Expand Down Expand Up @@ -1801,7 +1801,8 @@ static void connected(struct tu_env *env, struct bufferevent *bev)
else
{
getsockname(bufferevent_getfd(bev),
&state->loc_sin6, &state->loc_socklen);
(struct sockaddr *)&state->loc_sin6,
&state->loc_socklen);
if (state->response_out)
{
write_response(state->resp_file, RESP_SOCKNAME,
Expand Down
10 changes: 5 additions & 5 deletions eperd/traceroute.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,12 @@ static void report(struct trtstate *state)
fprintf(fh, DBQ(id) ":" DBQ(%s)
", %s"
", " DBQ(lts) ":%d"
", " DBQ(time) ":%ld"
", " DBQ(endtime) ":%ld, ",
", " DBQ(time) ":%llu"
", " DBQ(endtime) ":%llu, ",
state->atlas, atlas_get_version_json_str(),
get_timesync(),
state->starttime,
(long)atlas_time());
(unsigned long long)state->starttime,
(unsigned long long)atlas_time());
if (state->bundle_id)
fprintf(fh, DBQ(bundle) ":%s, ", state->bundle_id);
}
Expand Down Expand Up @@ -4631,7 +4631,7 @@ static int create_socket(struct trtstate *state, int do_tcp)
{
state->loc_socklen= sizeof(state->loc_sin6);
if (!state->response_in && getsockname(state->socket_icmp,
&state->loc_sin6,
(struct sockaddr *)&state->loc_sin6,
&state->loc_socklen) == -1)
{
crondlog(DIE9 "getsockname failed");
Expand Down
2 changes: 2 additions & 0 deletions include/libbb.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ char *is_suffixed_with(const char *string, const char *key) FAST_FUNC;
#define ATLAS_TIMESYNC_FILE_REL ATLAS_DATA_NEW_REL "/timesync.vol"
#define ATLAS_FUZZING_REL "data"

extern int atlas_unsafe(void);
extern char *rebased_validated_filename(const char *path, const char *prefix);
extern char *rebased_validated_dir(const char *path, const char *prefix);
extern int validate_atlas_id(const char *atlas_id);
Expand All @@ -484,6 +485,7 @@ extern void read_response(int fd, int type, size_t *sizep, void *data);
extern void read_response_file(FILE *file, int type, size_t *sizep,
void *data);
extern void write_response(FILE *file, int type, size_t size, void *data);
extern int rxtxrpt_main(int argc, char *argv[]);

int ndelay_on(int fd) FAST_FUNC;
int ndelay_off(int fd) FAST_FUNC;
Expand Down
2 changes: 1 addition & 1 deletion libbb/atlas_bb64.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ int buf_add(struct buf *buf, const void *data, size_t len )
newbuf= malloc(maxsize);
if (!newbuf)
{
fprintf(stderr, "unable to allocate %ld bytes\n", maxsize);
fprintf(stderr, "unable to allocate %ld bytes\n", (long)maxsize);
return (1);
}

Expand Down
2 changes: 2 additions & 0 deletions libbb/route_set_flags.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include <platform.h>
#include <net/route.h>

#include "libbb.h"

static const
IF_NOT_FEATURE_IPV6(uint16_t)
IF_FEATURE_IPV6(unsigned)
Expand Down
4 changes: 2 additions & 2 deletions miscutils/perd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1197,8 +1197,8 @@ static int atlas_run(char *cmdline)
fprintf(fn, "RESULT { ");
if (atlas_id)
fprintf(fn, DBQ(id) ":" DBQ(%s) ", ", atlas_id);
fprintf(fn, "%s, " DBQ(time) ":%d, ",
atlas_get_version_json_str(), time(NULL));
fprintf(fn, "%s, " DBQ(time) ":%llu, ",
atlas_get_version_json_str(), (unsigned long long)time(NULL));
if (reason != NULL)
fprintf(fn, DBQ(reason) ":" DBQ(%s) ", ", reason);
fprintf(fn, DBQ(err) ":%d, " DBQ(cmd) ": \"", r);
Expand Down
Loading