Handle ignored return values in extpipe and fix route/server format warnings

This commit is contained in:
Mario Fetka
2026-04-20 23:39:42 +02:00
parent 33d1da469a
commit 9087018b59
3 changed files with 25 additions and 19 deletions

View File

@@ -107,11 +107,16 @@ static int x_popen(char *command, int uid, int gid, FILE_PIPE *fp, int flags)
close(piped[j][x_] );
}
if (uid > -1 || gid > -1) {
seteuid(0);
if (gid > -1) setgid(gid);
if (uid > -1) setuid(uid);
if (gid > -1) setegid(gid);
if (uid > -1) seteuid(uid);
if (seteuid(0) != 0)
exit(1);
if (gid > -1 && setgid(gid) != 0)
exit(1);
if (uid > -1 && setuid(uid) != 0)
exit(1);
if (gid > -1 && setegid(gid) != 0)
exit(1);
if (uid > -1 && seteuid(uid) != 0)
exit(1);
}
if (flags&1)
execvp(buf, argv);

View File

@@ -551,7 +551,7 @@ static void send_sip_to_net(uint32 nd_net, int nd_ticks, int mode)
|| ( nw->net == nd_net && nw->hops) /* server has same net but */
/* hops */
|| ( mode == 2 && nw->hops) ) { /* no SAP to this NET */
XDPRINTF((3, 0, "No SAP mode=%d, to net=0x%lx for server '%s'",
XDPRINTF((3, 0, "No SAP mode=%d, to net=0x%x for server '%s'",
mode, nd_net, nw->name));
continue;
}

View File

@@ -729,7 +729,7 @@ static void handle_event(int fd, uint16 socknr, int slot)
uderr.opt.buf = (char*)&err_pack_typ; /* get actual typ */
ud.addr.buf = (char*)&source_adr;
t_rcvuderr(fd, &uderr);
XDPRINTF((2, 0, "Error from %s, Code = 0x%lx", visable_ipx_adr(&erradr), uderr.error));
XDPRINTF((2, 0, "Error from %s, Code = 0x%x", visable_ipx_adr(&erradr), uderr.error));
if (nw_debug) t_error("t_rcvudata !OK");
return;
}
@@ -866,12 +866,12 @@ static void get_ini(int full)
upstr(inhalt);
if (!strcmp(inhalt, "AUTO")) internal_net = 0;
else {
if (sscanf(inhalt, "%ld%c", &internal_net, &dummy) != 1)
sscanf(inhalt, "%lx", &internal_net);
if (sscanf(inhalt, "%u%c", &internal_net, &dummy) != 1)
sscanf(inhalt, "%x", &internal_net);
}
if (anz > 1) {
if (sscanf(inhalt2, "%ld%c", &node, &dummy) != 1)
sscanf(inhalt2, "%lx", &node);
if (sscanf(inhalt2, "%u%c", &node, &dummy) != 1)
sscanf(inhalt2, "%x", &node);
}
if (0 == internal_net) { /* now we try ip number */
char locname[50];
@@ -908,11 +908,11 @@ static void get_ini(int full)
nd->frame = IPX_FRAME_8023;
new_str(nd->devname, "eth0");
if (sscanf(inhalt, "%ld%c", &nd->net, &dummy) != 1)
sscanf(inhalt, "%lx", &nd->net);
if (sscanf(inhalt, "%u%c", &nd->net, &dummy) != 1)
sscanf(inhalt, "%x", &nd->net);
if (nd->net && (nd->net == internal_net)) {
errorp(11, "Get_ini", "device net 0x%lx = internal net", nd->net);
errorp(11, "Get_ini", "device net 0x%x = internal net", nd->net);
exit(1);
}
@@ -1012,7 +1012,7 @@ static void get_ini(int full)
NW_NET_DEVICE *nd=net_devices[k];
int result;
uint8 frname[30];
char *sp = "DEVICE=%s, FRAME=%s, NETWORK=0x%lx";
char *sp = "DEVICE=%s, FRAME=%s, NETWORK=0x%x";
(void) get_frame_name(frname, nd->frame);
XDPRINTF((1, 0, sp, nd->devname, frname, nd->net));
@@ -1049,7 +1049,7 @@ static void get_ini(int full)
print_routing_info(1);
#endif
XDPRINTF((1, 0, "%s name='%s', INTERNAL NET=0x%lx, NODE=0x%02x:%02x:%02x:%02x:%02x:%02x",
XDPRINTF((1, 0, "%s name='%s', INTERNAL NET=0x%x, NODE=0x%02x:%02x:%02x:%02x:%02x:%02x",
prog_name_typ, my_nwname, internal_net,
(int)my_server_adr.node[0],
(int)my_server_adr.node[1],
@@ -1308,8 +1308,8 @@ int main(int argc, char **argv)
# endif
if (*a == 'a' && frame > -1) {
char dummy;
if (sscanf(argv[j+3], "%ld%c", &netnum, &dummy) != 1)
sscanf(argv[j+3], "%lx", &netnum);
if (sscanf(argv[j+3], "%u%c", &netnum, &dummy) != 1)
sscanf(argv[j+3], "%x", &netnum);
}
#if IN_NWROUTED || INTERNAL_RIP_SAP
if (netnum > 0)
@@ -1340,7 +1340,8 @@ int main(int argc, char **argv)
return(usage(argv[0]));
}
#if !DO_TESTING
chdir("/");
if (chdir("/") < 0)
perror("chdir");
#endif
setgroups(0, NULL);
init_tools(IN_PROG, init_mode);