Clean up emutli warnings and libc feature macros

This commit is contained in:
Mario Fetka
2026-04-20 23:39:42 +02:00
parent 368b36eb95
commit f0bfd5a641
5 changed files with 21 additions and 18 deletions

View File

@@ -127,9 +127,9 @@ extern int t_bind(int sock, struct t_bind *a_in, struct t_bind *a_out);
extern int t_unbind(int sock);
extern void t_error(char *s);
extern int t_close(int fd);
extern inline int t_rcvudata(int fd, struct t_unitdata *ud, int *flags);
extern int t_rcvudata(int fd, struct t_unitdata *ud, int *flags);
extern int t_rcvuderr(int fd, struct t_uderr *ud);
extern inline int t_sndudata(int fd, struct t_unitdata *ud);
extern int t_sndudata(int fd, struct t_unitdata *ud);
#ifndef IPX_FRAME_8022
# define OLD_KERNEL_IPX 1

View File

@@ -23,8 +23,8 @@
#ifndef _XOPEN_SOURCE
# define _XOPEN_SOURCE 1
#endif
#ifndef _SVID_SOURCE
#define _SVID_SOURCE 1
#ifndef _DEFAULT_SOURCE
# define _DEFAULT_SOURCE 1
#endif
#include <ctype.h>
#include <stdio.h>

View File

@@ -92,10 +92,10 @@ void set_emu_tli(void)
errorp(10, "set_emu_tli", "Missing ini entry 3");
return;
}
sscanf((char*)buff, "%lx", &net);
sscanf((char*)buff, "%x", &net);
ipx_netlong(fbsd_ipx)=htonl(net);
if( ipx_iffind(NULL,&fbsd_ipx) )
errorp(10, "set_emu_tli", "Can't find ipx interface for net=%lx",net);
errorp(10, "set_emu_tli", "Can't find ipx interface for net=%x", net);
}
#endif
}
@@ -123,7 +123,7 @@ int t_open(char *name, int open_mode, char * p)
int t_bind(int sock, struct t_bind *a_in, struct t_bind *a_out)
{
struct sockaddr_ipx ipxs;
int maxplen=sizeof(struct sockaddr_ipx);
socklen_t maxplen=sizeof(struct sockaddr_ipx);
memset((char*)&ipxs, 0, sizeof(struct sockaddr_ipx));
ipxs.sipx_family=AF_IPX;
@@ -242,7 +242,7 @@ int poll( struct pollfd *fds, unsigned long nfds, int timeout)
inline int t_rcvudata(int fd, struct t_unitdata *ud, int *flags)
{
struct sockaddr_ipx ipxs;
int sz = sizeof(struct sockaddr_ipx);
socklen_t sz = sizeof(struct sockaddr_ipx);
int result;
ipxs.sipx_family=AF_IPX;
if (ud->addr.maxlen < sizeof(ipxAddr_t)) return(-1);

View File

@@ -78,9 +78,9 @@ int read_interface_data(uint8* data, uint32 *rnet, uint8 *node,
if (!rnet) rnet =&snet;
if (!flags) flags=&xflags;
else *flags=0;
if (sscanf(data, "%lx %s %s %s %s",
rnet, buff1, buff2, buff3, buff4) == 5 ) {
int len = strlen(buff4);
if (sscanf((char*)data, "%x %199s %199s %199s %199s",
rnet, (char*)buff1, (char*)buff2, (char*)buff3, (char*)buff4) == 5 ) {
int len = strlen((char*)buff4);
if (!len) return(-2);
switch (*(buff4+len-1)) {
case '2' : frame = IPX_FRAME_8022; break;
@@ -97,12 +97,12 @@ int read_interface_data(uint8* data, uint32 *rnet, uint8 *node,
if (node) strmaxcpy(node, buff1, 12);
upstr(buff2);
if (!strcmp(buff2, "YES")) /* primary */
if (!strcmp((char*)buff2, "YES")) /* primary */
*flags |= 1;
if (name) strmaxcpy(name, buff3, 20);
upstr(buff3);
if (!strcmp(buff3, "INTERNAL")) /* internal net */
if (!strcmp((char*)buff3, "INTERNAL")) /* internal net */
*flags |= 2;
}
return(frame);
@@ -291,7 +291,7 @@ int ipx_inuse(int mode)
while (fgets((char*)buff, sizeof(buff), f) != NULL){
uint32 network;
int sock;
if (2==sscanf(buff, "%lx:%x", &network, &sock)) {
if (2==sscanf((char*)buff, "%x:%x", &network, &sock)) {
if (mode == 0) {
if (sock >= 0x4000) { /* user socket */
idle=sock;
@@ -358,7 +358,7 @@ int init_ipx(uint32 network, uint32 node, int ipx_debug, int flags)
exit(1);
}
} else {
int maxplen=sizeof(struct sockaddr_ipx);
socklen_t maxplen=sizeof(struct sockaddr_ipx);
if (getsockname(sock, (struct sockaddr*)&ipxs, &maxplen) != -1)
primary_net= ntohl(ipxs.sipx_network);
if (primary_net)

View File

@@ -284,7 +284,10 @@ FILE *open_nw_ini(void)
int uid=geteuid();
if (!logfile) logfile = stderr;
if (f == (FILE*)NULL && uid > 0) {
seteuid(0);
if (seteuid(0)) {
errorp(1, "seteuid", "uid=0");
return f;
}
f=fopen(fname, "r");
if (seteuid(uid)) {
errorp(1, "seteuid", "uid=%d", uid);
@@ -457,8 +460,8 @@ void get_debug_level(uint8 *buf)
debug_mask=0;
if (i > 1) {
char dummy;
if (sscanf(buf2, "%ld%c", &debug_mask, &dummy) != 1)
sscanf(buf2, "%lx", &debug_mask);
if (sscanf(buf2, "%u%c", &debug_mask, &dummy) != 1)
sscanf(buf2, "%x", &debug_mask);
}
}
}