Skip to content
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
2 changes: 1 addition & 1 deletion tinydnssec-x/auto-str.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <unistd.h>

char bspace[256];
substdio b = SUBSTDIO_FDBUF(write,1,bspace,sizeof bspace);
substdio b = SUBSTDIO_FDBUF((ssize_t (*)(int, char *, size_t)) write,1,bspace,sizeof bspace);

void myputs(const char *s)
{
Expand Down
8 changes: 4 additions & 4 deletions tinydnssec-x/axfr-get.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ ssize_t safewrite(int fd,char *buf,unsigned int len)
return r;
}
char netreadspace[1024];
substdio netread = SUBSTDIO_FDBUF(saferead,6,netreadspace,sizeof netreadspace);
substdio netread = SUBSTDIO_FDBUF((ssize_t (*)(int, char *, size_t)) saferead,6,netreadspace,sizeof netreadspace);
char netwritespace[1024];
substdio netwrite = SUBSTDIO_FDBUF(safewrite,7,netwritespace,sizeof netwritespace);
substdio netwrite = SUBSTDIO_FDBUF((ssize_t (*)(int, char *, size_t)) safewrite,7,netwritespace,sizeof netwritespace);

void netget(char *buf,unsigned int len)
{
Expand Down Expand Up @@ -317,7 +317,7 @@ int main(int argc,char **argv)
if (errno != error_noent) die_read();
}
else {
substdio_fdbuf(&b,read,fd,bspace,sizeof bspace);
substdio_fdbuf(&b,(ssize_t (*)(int, char *, size_t)) read,fd,bspace,sizeof bspace);
if (getln(&b,&line,&match,'\n') == -1) die_read();
if (!stralloc_0(&line)) die_read();
if (line.s[0] == '#') {
Expand Down Expand Up @@ -370,7 +370,7 @@ int main(int argc,char **argv)

fd = open_trunc(fntmp);
if (fd == -1) die_write();
substdio_fdbuf(&b,write,fd,bspace,sizeof bspace);
substdio_fdbuf(&b,(ssize_t (*)(int, char *, size_t)) write,fd,bspace,sizeof bspace);

if (!stralloc_copyb(&packet,"\0\0\0\0\0\1\0\0\0\0\0\0",12)) die_generate();
if (!stralloc_catb(&packet,zone,zonelen)) die_generate();
Expand Down
4 changes: 2 additions & 2 deletions tinydnssec-x/axfrdns.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ ssize_t safewrite(int fd,char *buf,unsigned int len)
}

char netwritespace[1024];
substdio netwrite = SUBSTDIO_FDBUF(safewrite,1,netwritespace,sizeof netwritespace);
substdio netwrite = SUBSTDIO_FDBUF((ssize_t (*)(int, char *, size_t)) safewrite,1,netwritespace,sizeof netwritespace);

void print(char *buf,unsigned int len)
{
Expand Down Expand Up @@ -256,7 +256,7 @@ void doaxfr(char id[2])
print(soa.s,soa.len);

seek_begin(fdcdb);
substdio_fdbuf(&bcdb,read,fdcdb,bcdbspace,sizeof bcdbspace);
substdio_fdbuf(&bcdb,(ssize_t (*)(int, char *, size_t)) read,fdcdb,bcdbspace,sizeof bcdbspace);

pos = 0;
get(num,4); pos += 4;
Expand Down
2 changes: 1 addition & 1 deletion tinydnssec-x/curvedns-conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ int main(int argc,char **argv)
outs(auto_home); outs("/bin/curvedns $LISTEN_IPS $LISTEN_PORT $TARGET_IP $TARGET_PORT\n'\n"); finish();
perm(0755);
start("private.key");
substdio_fdbuf(&sspbuf,read,privatekeyfd,pbuf,sizeof pbuf);
substdio_fdbuf(&sspbuf,(ssize_t (*)(int, char *, size_t)) read,privatekeyfd,pbuf,sizeof pbuf);
copyfrom(&sspbuf);
finish();
perm(0600);
Expand Down
2 changes: 1 addition & 1 deletion tinydnssec-x/dnscache-conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ int main(int argc,char **argv)
seed_addtime(); makedir("root/servers");
seed_addtime(); perm(02755);
seed_addtime(); start("root/servers/@");
substdio_fdbuf(&ssrootservers,read,fdrootservers,rootserversbuf,sizeof rootserversbuf);
substdio_fdbuf(&ssrootservers,(ssize_t (*)(int, char *, size_t)) read,fdrootservers,rootserversbuf,sizeof rootserversbuf);
copyfrom(&ssrootservers);
finish();
seed_addtime(); perm(0644);
Expand Down
2 changes: 1 addition & 1 deletion tinydnssec-x/dnscache.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ static void doit(void)
char seed[128];

void
SigTerm()
SigTerm(int x)
{
_exit(0);
}
Expand Down
2 changes: 1 addition & 1 deletion tinydnssec-x/dq-20161210/dq/buffer.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "buffer.h"

void buffer_init(buffer *s, long long (*op)(), int fd, char *buf, long long len) {
void buffer_init(buffer *s, long long (*op)(int, char *, unsigned long long), int fd, char *buf, unsigned long long len) {

s->x = buf;
s->fd = fd;
Expand Down
20 changes: 10 additions & 10 deletions tinydnssec-x/dq-20161210/dq/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ typedef struct buffer {
long long p;
long long n;
int fd;
long long (*op)();
long long (*op)(int, char *, unsigned long long);
} buffer;

#define BUFFER_INIT(op, fd, buf, len) { (buf), 0, (len), (fd), (op) }
#define BUFFER_INSIZE 8192
#define BUFFER_OUTSIZE 8192
#define BUFFER_ERRSIZE 256

extern void buffer_init(buffer *, long long (*op)(), int, char *, long long);
extern void buffer_init(buffer *, long long (*op)(int, char *, unsigned long long), int, char *, unsigned long long);

extern int buffer_flush(buffer *);
extern int buffer_putalign(buffer *, const char *, long long);
extern int buffer_put(buffer *, const char *, long long);
extern int buffer_putflush(buffer *, const char *, long long);
extern int buffer_putalign(buffer *, const char *, unsigned long long);
extern int buffer_put(buffer *, const char *, unsigned long long);
extern int buffer_putflush(buffer *, const char *, unsigned long long);
extern int buffer_putsalign(buffer *, const char *);
extern int buffer_puts(buffer *, const char *);
extern int buffer_putsflush(buffer *, const char *);
Expand All @@ -30,12 +30,12 @@ extern int buffer_putsflush(buffer *, const char *);
: buffer_put((s),&(c),1) \
)

extern long long buffer_get(buffer *, char *, long long);
extern long long buffer_bget(buffer *, char *, long long);
extern long long buffer_get(buffer *, char *, unsigned long long);
extern long long buffer_bget(buffer *, char *, unsigned long long);
extern long long buffer_feed(buffer *);

extern char *buffer_peek(buffer *);
extern void buffer_seek(buffer *, long long);
extern void buffer_seek(buffer *, unsigned long long);

#define buffer_PEEK(s) ( (s)->x + (s)->n )
#define buffer_SEEK(s,len) ( ( (s)->p -= (len) ) , ( (s)->n += (len) ) )
Expand All @@ -48,8 +48,8 @@ extern void buffer_seek(buffer *, long long);

extern int buffer_copy(buffer *,buffer *);

extern long long buffer_unixread(int, char *, long long);
extern long long buffer_unixwrite(int, const char *, long long);
extern long long buffer_unixread(int, char *, unsigned long long);
extern long long buffer_unixwrite(int, const char *, unsigned long long);

#define buffer_PEEK(s) ( (s)->x + (s)->n )
#define buffer_SEEK(s, len) ( ( (s)->p -= (len) ) , ( (s)->n += (len) ) )
Expand Down
2 changes: 1 addition & 1 deletion tinydnssec-x/dq-20161210/dq/buffer_2.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "buffer.h"

char buffer_2_space[BUFFER_ERRSIZE];
static buffer it = BUFFER_INIT(buffer_unixwrite, 2, buffer_2_space, sizeof buffer_2_space);
static buffer it = BUFFER_INIT((long long (*)(int, char *, unsigned long long)) buffer_unixwrite, 2, buffer_2_space, sizeof buffer_2_space);
buffer *buffer_2 = &it;
14 changes: 7 additions & 7 deletions tinydnssec-x/dq-20161210/dq/buffer_put.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "byte.h"
#include "buffer.h"

static int allwrite(long long (*op)(int, const char *, long long), int fd, const char *buf, long long len) {
static int allwrite(long long (*op)(int, const char *, unsigned long long), int fd, const char *buf, unsigned long long len) {

long long w;

Expand Down Expand Up @@ -31,10 +31,10 @@ int buffer_flush(buffer *s) {
p = s->p;
if (!p) return 0;
s->p = 0;
return allwrite(s->op, s->fd, s->x, p);
return allwrite((long long (*)(int, const char *, unsigned long long)) s->op, s->fd, s->x, p);
}

int buffer_putalign(buffer *s, const char *buf, long long len) {
int buffer_putalign(buffer *s, const char *buf, unsigned long long len) {

long long n;

Expand All @@ -52,7 +52,7 @@ int buffer_putalign(buffer *s, const char *buf, long long len) {
}


int buffer_put(buffer *s, const char *buf, long long len) {
int buffer_put(buffer *s, const char *buf, unsigned long long len) {

long long n;

Expand All @@ -65,7 +65,7 @@ int buffer_put(buffer *s, const char *buf, long long len) {
if (n < BUFFER_OUTSIZE) n = BUFFER_OUTSIZE;
while (len > s->n) {
if (n > len) n = len;
if (allwrite(s->op, s->fd, buf, n) == -1) return -1;
if (allwrite((long long (*)(int, const char *, unsigned long long)) s->op, s->fd, buf, n) == -1) return -1;
buf += n;
len -= n;
}
Expand All @@ -76,9 +76,9 @@ int buffer_put(buffer *s, const char *buf, long long len) {
return 0;
}

int buffer_putflush(buffer *s, const char *buf, long long len) {
int buffer_putflush(buffer *s, const char *buf, unsigned long long len) {
if (buffer_flush(s) == -1) return -1;
return allwrite(s->op, s->fd, buf, len);
return allwrite((long long (*)(int, const char *, unsigned long long)) s->op, s->fd, buf, len);
}

int buffer_putsalign(buffer *s, const char *buf) {
Expand Down
2 changes: 1 addition & 1 deletion tinydnssec-x/dq-20161210/dq/buffer_write.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "writeall.h"
#include "buffer.h"

long long buffer_unixwrite(int fd, const char *x, long long xlen) {
long long buffer_unixwrite(int fd, const char *x, unsigned long long xlen) {

if (writeall(fd, x, xlen) == -1) return -1;
return xlen;
Expand Down
2 changes: 1 addition & 1 deletion tinydnssec-x/dq-20161210/dq/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ int cache_dump(void) {
fd = open_trunc(fntmp);
if (fd == -1) return -1;

buffer_init(&b, buffer_unixwrite, fd, bspace, sizeof bspace);
buffer_init(&b, (long long (*)(int, char *, unsigned long long)) buffer_unixwrite, fd, bspace, sizeof bspace);

pos = oldest;
while (pos < unused) {
Expand Down
2 changes: 1 addition & 1 deletion tinydnssec-x/dqcache-conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ int main(int argc,char **argv)
makedir("root/servers");
perm(02755);
start("root/servers/@");
substdio_fdbuf(&ssrootservers,read,fdrootservers,rootserversbuf,sizeof rootserversbuf);
substdio_fdbuf(&ssrootservers,(ssize_t (*)(int, char *, size_t)) read,fdrootservers,rootserversbuf,sizeof rootserversbuf);
copyfrom(&ssrootservers);
finish();
perm(0644);
Expand Down
2 changes: 1 addition & 1 deletion tinydnssec-x/generic-conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void start(const char *s)
fn = s;
fd = open_trunc(fn);
if (fd == -1) fail();
substdio_fdbuf(&ss,write,fd,buf,sizeof buf);
substdio_fdbuf(&ss,(ssize_t (*)(int, char *, size_t)) write,fd,buf,sizeof buf);
}

void outs(const char *s)
Expand Down
6 changes: 3 additions & 3 deletions tinydnssec-x/installer.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,10 +480,10 @@ doit(stralloc *line, int uninstall, int check)
else
strerr_die4sys(111, FATAL, "unable to read ", name, ": ");
}
substdio_fdbuf(&ssin, read, fdin, inbuf, sizeof (inbuf));
substdio_fdbuf(&ssin, (ssize_t (*)(int, char *, size_t)) read, fdin, inbuf, sizeof (inbuf));
if ((fdout = open_trunc(target.s)) == -1)
strerr_die4sys(111, FATAL, "unable to write ", target.s, ": ");
substdio_fdbuf(&ssout, write, fdout, outbuf, sizeof (outbuf));
substdio_fdbuf(&ssout, (ssize_t (*)(int, char *, size_t)) write, fdout, outbuf, sizeof (outbuf));
switch (substdio_copy(&ssout, &ssin))
{
case -2:
Expand Down Expand Up @@ -542,7 +542,7 @@ die_usage()
}

char buf[256];
substdio in = SUBSTDIO_FDBUF(read, 0, buf, sizeof (buf));
substdio in = SUBSTDIO_FDBUF((ssize_t (*)(int, char *, size_t)) read, 0, buf, sizeof (buf));
stralloc line = { 0 };

int
Expand Down
2 changes: 1 addition & 1 deletion tinydnssec-x/pickdns-data.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ int main()

fd = open_read("data");
if (fd == -1) strerr_die2sys(111,FATAL,"unable to open data: ");
substdio_fdbuf(&b,read,fd,bspace,sizeof bspace);
substdio_fdbuf(&b,(ssize_t (*)(int, char *, size_t)) read,fd,bspace,sizeof bspace);

fdcdb = open_trunc("data.tmp");
if (fdcdb == -1) die_datatmp();
Expand Down
2 changes: 1 addition & 1 deletion tinydnssec-x/rbldns-data.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ int main()

fd = open_read("data");
if (fd == -1) strerr_die2sys(111,FATAL,"unable to open data: ");
substdio_fdbuf(&b,read,fd,bspace,sizeof bspace);
substdio_fdbuf(&b,(ssize_t (*)(int, char *, size_t)) read,fd,bspace,sizeof bspace);

fdcdb = open_trunc("data.tmp");
if (fdcdb == -1) die_datatmp();
Expand Down
1 change: 0 additions & 1 deletion tinydnssec-x/select.h1
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@

#include <sys/types.h>
#include <sys/time.h>
extern int select();

#endif
1 change: 0 additions & 1 deletion tinydnssec-x/select.h2
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
#include <sys/types.h>
#include <sys/time.h>
#include <sys/select.h>
extern int select();

#endif
2 changes: 1 addition & 1 deletion tinydnssec-x/tinydns-data.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ int main()
strerr_die2sys(111,FATAL,"unable to open data: ");
defaultsoa_init(fddata);

substdio_fdbuf(&b,read,fddata,bspace,sizeof bspace);
substdio_fdbuf(&b,(ssize_t (*)(int, char *, size_t)) read,fddata,bspace,sizeof bspace);

fdcdb = open_trunc("data.tmp");
if (fdcdb == -1) die_datatmp();
Expand Down
4 changes: 2 additions & 2 deletions tinydnssec-x/tinydns-edit.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ int main(int argc,char **argv)
fd = open_read(fn);
if (fd == -1) die_read();
if (fstat(fd,&st) == -1) die_read();
substdio_fdbuf(&b,read,fd,bspace,sizeof bspace);
substdio_fdbuf(&b,(ssize_t (*)(int, char *, size_t)) read,fd,bspace,sizeof bspace);

fdnew = open_trunc(fnnew);
if (fdnew == -1) die_write();
if (fchmod(fdnew,st.st_mode & 0644) == -1) die_write();
substdio_fdbuf(&bnew,write,fdnew,bnewspace,sizeof bnewspace);
substdio_fdbuf(&bnew,(ssize_t (*)(int, char *, size_t)) write,fdnew,bnewspace,sizeof bnewspace);

switch(mode) {
case '.': case '&':
Expand Down
Loading