summaryrefslogtreecommitdiff
path: root/src/minidentd/mgetuid-linux.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-03-12 19:39:01 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-03-12 19:39:01 +0000
commit53091e3bce487ee82e2805a0231e780551561717 (patch)
treef0fa36ff8eadaf1f01d4510597b5e3a310764dc7 /src/minidentd/mgetuid-linux.c
parentf85b8a70f3b44510a5cf3895bf7357ae90655f65 (diff)
downloads6-networking-53091e3bce487ee82e2805a0231e780551561717.tar.xz
Adapt to skalibs-2.5.0.0
Diffstat (limited to 'src/minidentd/mgetuid-linux.c')
-rw-r--r--src/minidentd/mgetuid-linux.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/minidentd/mgetuid-linux.c b/src/minidentd/mgetuid-linux.c
index 18caba7..f374adf 100644
--- a/src/minidentd/mgetuid-linux.c
+++ b/src/minidentd/mgetuid-linux.c
@@ -1,12 +1,10 @@
/* ISC license. */
#include <sys/types.h>
+#include <string.h>
#include <stdint.h>
-#include <skalibs/uint16.h>
-#include <skalibs/uint32.h>
#include <skalibs/uint64.h>
-#include <skalibs/uint.h>
-#include <skalibs/bytestr.h>
+#include <skalibs/types.h>
#include <skalibs/fmtscan.h>
#include <skalibs/buffer.h>
#include <skalibs/stralloc.h>
@@ -33,10 +31,10 @@ static int skipspace (char **s)
static void reverse_address (char *s, size_t n)
{
- register size_t i = n >> 1 ;
+ size_t i = n >> 1 ;
while (i--)
{
- register char tmp = s[i] ;
+ char tmp = s[i] ;
s[i] = s[n-1-i] ;
s[n-1-i] = tmp ;
}
@@ -46,9 +44,9 @@ static int parseline (char *s, size_t len, uid_t *u, char *la, uint16_t *lp, cha
{
char *cur = s ;
size_t pos ;
- uint64 uu ;
+ uint64_t uu ;
uint32_t junk ;
- register unsigned int iplen = is6 ? 16 : 4 ;
+ unsigned int iplen = is6 ? 16 : 4 ;
if (!skipspace(&cur)) bug("initial whitespace") ;
pos = uint32_scan(cur, &junk) ; /* sl */
@@ -149,7 +147,7 @@ uid_t mgetuid (ip46_t const *localaddr, uint16_t localport, ip46_t const *remote
stralloc line = STRALLOC_ZERO ;
buffer b ;
char y[BUFFER_INSIZE] ;
- register int is6 = ip46_is6(localaddr) ;
+ int is6 = ip46_is6(localaddr) ;
int fd = open_readb(is6 ? "/proc/net/tcp6" : "/proc/net/tcp") ;
if (fd == -1) return -2 ;
buffer_init(&b, &buffer_read, fd, y, BUFFER_INSIZE_SMALL) ;
@@ -173,8 +171,8 @@ uid_t mgetuid (ip46_t const *localaddr, uint16_t localport, ip46_t const *remote
debuglog(lp, rp, nu, la, ra, is6) ;
#endif
if ((lp == localport) && (rp == remoteport)
- && !byte_diff(la, is6 ? 16 : 4, localaddr->ip)
- && !byte_diff(ra, is6 ? 16 : 4, remoteaddr->ip))
+ && !memcmp(la, localaddr->ip, is6 ? 16 : 4)
+ && !memcmp(ra, remoteaddr->ip, is6 ? 16 : 4))
{
u = nu ; break ;
}