djbdns: Fix compile warnings and errors

This adds a new patch to the package definition that fixes compiler
warnings and errors by including the correct files, or by adding the
required forward declarations.

At one point the other used implicit pointer conversion, this has been
done explicitly now. As such, it should retain its behaviour, for good
or worse.

Signed-off-by: Marcel Müller <neikos@neikos.email>

+130
+127
pkgs/by-name/dj/djbdns/fix-warnings.patch
··· 1 + diff --git a/chkshsgr.c b/chkshsgr.c 2 + index b6eb8a1..caa1b2b 100644 3 + --- a/chkshsgr.c 4 + +++ b/chkshsgr.c 5 + @@ -1,9 +1,11 @@ 6 + +#include <unistd.h> 7 + +#include <grp.h> 8 + #include "exit.h" 9 + 10 + int main() 11 + { 12 + return 0; 13 + - short x[4]; 14 + + unsigned int x[4]; 15 + 16 + x[0] = x[1] = 0; 17 + if (getgroups(1,x) == 0) if (setgroups(1,x) == -1) _exit(1); 18 + diff --git a/dnsq.c b/dnsq.c 19 + index 533e6af..23b08e7 100644 20 + --- a/dnsq.c 21 + +++ b/dnsq.c 22 + @@ -1,3 +1,4 @@ 23 + +#include <unistd.h> 24 + #include "uint16.h" 25 + #include "strerr.h" 26 + #include "buffer.h" 27 + diff --git a/dnsqr.c b/dnsqr.c 28 + index ff8ea6e..d3879ea 100644 29 + --- a/dnsqr.c 30 + +++ b/dnsqr.c 31 + @@ -1,3 +1,4 @@ 32 + +#include <unistd.h> 33 + #include "uint16.h" 34 + #include "strerr.h" 35 + #include "buffer.h" 36 + diff --git a/hier.c b/hier.c 37 + index a598e61..6eddb21 100644 38 + --- a/hier.c 39 + +++ b/hier.c 40 + @@ -1,4 +1,5 @@ 41 + #include "auto_home.h" 42 + +#include "instcheck.h" 43 + 44 + void hier() 45 + { 46 + diff --git a/instcheck.h b/instcheck.h 47 + new file mode 100644 48 + index 0000000..056b74c 49 + --- /dev/null 50 + +++ b/instcheck.h 51 + @@ -0,0 +1,9 @@ 52 + +void h(const char *home, int uid, int gid, int mode); 53 + + 54 + +void d(const char *home, char *subdir, int uid, int gid, int mode); 55 + + 56 + +void p(char *home, char *fifo, int uid, int gid, int mode); 57 + + 58 + +void c(const char *home, char *subdir, char *file, int uid, int gid, int mode); 59 + + 60 + +void z(char *home, char *file, int len, int uid, int gid, int mode); 61 + diff --git a/prot.c b/prot.c 62 + index 0a8a373..1c56e9c 100644 63 + --- a/prot.c 64 + +++ b/prot.c 65 + @@ -1,3 +1,5 @@ 66 + +#include <grp.h> 67 + +#include <unistd.h> 68 + #include "hasshsgr.h" 69 + #include "prot.h" 70 + 71 + diff --git a/seek_set.c b/seek_set.c 72 + index d08d4f3..47c61e4 100644 73 + --- a/seek_set.c 74 + +++ b/seek_set.c 75 + @@ -1,4 +1,5 @@ 76 + #include <sys/types.h> 77 + +#include <unistd.h> 78 + #include "seek.h" 79 + 80 + #define SET 0 /* sigh */ 81 + diff --git a/tinydns-data.c b/tinydns-data.c 82 + index ba82f84..c70382e 100644 83 + --- a/tinydns-data.c 84 + +++ b/tinydns-data.c 85 + @@ -251,19 +251,19 @@ int main() 86 + if (!dns_domain_fromdot(&d1,f[0].s,f[0].len)) nomem(); 87 + 88 + if (!stralloc_0(&f[3])) nomem(); 89 + - if (!scan_ulong(f[3].s,&u)) uint32_unpack_big(defaultsoa,&u); 90 + + if (!scan_ulong(f[3].s,&u)) uint32_unpack_big(defaultsoa,(unsigned int *)&u); 91 + uint32_pack_big(soa,u); 92 + if (!stralloc_0(&f[4])) nomem(); 93 + - if (!scan_ulong(f[4].s,&u)) uint32_unpack_big(defaultsoa + 4,&u); 94 + + if (!scan_ulong(f[4].s,&u)) uint32_unpack_big(defaultsoa + 4,(unsigned int *)&u); 95 + uint32_pack_big(soa + 4,u); 96 + if (!stralloc_0(&f[5])) nomem(); 97 + - if (!scan_ulong(f[5].s,&u)) uint32_unpack_big(defaultsoa + 8,&u); 98 + + if (!scan_ulong(f[5].s,&u)) uint32_unpack_big(defaultsoa + 8,(unsigned int *)&u); 99 + uint32_pack_big(soa + 8,u); 100 + if (!stralloc_0(&f[6])) nomem(); 101 + - if (!scan_ulong(f[6].s,&u)) uint32_unpack_big(defaultsoa + 12,&u); 102 + + if (!scan_ulong(f[6].s,&u)) uint32_unpack_big(defaultsoa + 12,(unsigned int *)&u); 103 + uint32_pack_big(soa + 12,u); 104 + if (!stralloc_0(&f[7])) nomem(); 105 + - if (!scan_ulong(f[7].s,&u)) uint32_unpack_big(defaultsoa + 16,&u); 106 + + if (!scan_ulong(f[7].s,&u)) uint32_unpack_big(defaultsoa + 16,(unsigned int *)&u); 107 + uint32_pack_big(soa + 16,u); 108 + 109 + if (!stralloc_0(&f[8])) nomem(); 110 + diff --git a/utime.c b/utime.c 111 + index 4b7984f..6a64060 100644 112 + --- a/utime.c 113 + +++ b/utime.c 114 + @@ -1,3 +1,4 @@ 115 + +#include <utime.h> 116 + #include <sys/types.h> 117 + #include <sys/time.h> 118 + #include "scan.h" 119 + @@ -19,6 +20,7 @@ int main(int argc,char **argv) 120 + scan_ulong(ustr,&u); 121 + 122 + ut[0] = ut[1] = u; 123 + - if (utime(fn,ut) == -1) _exit(111); 124 + + struct utimbuf new_time = { .actime = u, .modtime = u }; 125 + + if (utime(fn,&new_time) == -1) _exit(111); 126 + _exit(0); 127 + }
+3
pkgs/by-name/dj/djbdns/package.nix
··· 33 33 # To fix https://github.com/NixOS/nixpkgs/issues/119066. 34 34 # Note that the NixOS test <nixpkgs/nixos/tests/tinydns.nix> tests for this. 35 35 ./softlimit.patch 36 + 37 + # Fix warnings introduced due to implicit type conversions and implicit function declarations 38 + ./fix-warnings.patch 36 39 ]; 37 40 38 41 postPatch = ''