Commit 698cbb29 authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Fixes from static analysis

Ref https://www.riscosopen.org/forum/forums/4/topics/9503#posts-72595 and subsequent offline checks.

arp: missing return from non-void delete() (from FreeBSD 13977)
ifconfig: undefined variable m (from FreeBSD revision 13145)
          correct return types to void for xxx_getaddr() (from FreeBSD revision 19914)
inetstat: dead array variable buf2[] removed
ipvars: missing return value from main()
map-mbone: missing va_end (from NetBSD revision 1.8)
md5: file handle leak on error (from FreeBSD revision 292955)
mrinfo: missing va_end (from NetBSD revision 1.12)
mtrace: missing va_end (from NetBSD revision 1.18)
newfiler: add comment for apparent missing return
sysctl: fix QUAD variable type (from FreeBSD revision 88696)
        though academic since Internet doesn't have any quad_t variables explicit function return types added in PathConf.c
BootNet: change RMIfThere alias to use temporary variable from its own namespace

Version 5.61. Tagged as 'Internet-5_61'
parent def645fa
......@@ -8,7 +8,7 @@
|=================================================================
IF "<Inet$HostName>" <> "" AND "<Inet$HostName>" <> "ARM_NoName" THEN Error BootNet should not be run after !Internet. Use InetSetup to configure AUN + TCP/IP.
IF "<Wimp$State>" = "desktop" THEN Error BootNet should only be run outside the desktop
Set Alias$RMIfThere SetEval Test$Eval 1|MRMEnsure %%1 0 SetEval Test$Eval 0|MIf Test$Eval THEN %%0 %%1|MUnset Test$Eval
Set Alias$RMIfThere SetEval Inet$TestEval 1|MRMEnsure %%1 0 SetEval Inet$TestEval 0|MIf Inet$TestEval THEN %%0 %%1|MUnset Inet$TestEval
|
| Check for RISC OS 3.50 or later
|
......
......@@ -368,8 +368,11 @@ delete:
printf("cannot locate %s\n", host);
return (1);
}
if (rtmsg(RTM_DELETE) == 0)
if (rtmsg(RTM_DELETE) == 0) {
printf("%s (%s) deleted\n", host, inet_ntoa(sin->sin_addr));
return (0);
}
return (1);
}
/*
......
......@@ -168,11 +168,11 @@ struct cmd {
* Maryland principally by James O'Toole and Chris Torek.
*/
void in_status();
int in_getaddr();
void in_getaddr();
void xns_status();
int xns_getaddr();
void xns_getaddr();
void iso_status();
int iso_getaddr();
void iso_getaddr();
void ether_status();
/* Known address families */
......@@ -180,7 +180,7 @@ struct afswtch {
char *af_name;
short af_af;
void (*af_status)();
int (*af_getaddr)();
void (*af_getaddr)();
int af_difaddr;
int af_aifaddr;
caddr_t af_ridreq;
......@@ -702,7 +702,7 @@ void ether_status(void)
char *cp;
struct sockaddr *sa;
struct sockaddr_dl *sdl;
int n,m;
int n;
char ifacename[IFNAMSIZ];
/*
......@@ -747,7 +747,7 @@ void ether_status(void)
if ((n = sdl->sdl_alen) > 0) {
printf (" ether ");
while (--n >= 0)
m += printf("%02x%c",
printf("%02x%c",
*cp++ & 0xff,
n > 0 ? ':' : ' ');
putchar('\n');
......@@ -796,7 +796,7 @@ struct sockaddr_in *sintab[] = {
SIN(ridreq.ifr_addr), SIN(addreq.ifra_addr),
SIN(addreq.ifra_mask), SIN(addreq.ifra_broadaddr)};
int in_getaddr(char *s, int which)
void in_getaddr(char *s, int which)
{
register struct sockaddr_in *sin = sintab[which];
struct hostent *hp;
......@@ -855,7 +855,7 @@ struct sockaddr_ns *snstab[] = {
SNS(ridreq.ifr_addr), SNS(addreq.ifra_addr),
SNS(addreq.ifra_mask), SNS(addreq.ifra_broadaddr)};
int xns_getaddr(char *addr, int which)
void xns_getaddr(char *addr, int which)
{
struct sockaddr_ns *sns = snstab[which];
struct ns_addr ns_addr();
......@@ -872,7 +872,7 @@ struct sockaddr_iso *sisotab[] = {
SISO(iso_ridreq.ifr_Addr), SISO(iso_addreq.ifra_addr),
SISO(iso_addreq.ifra_mask), SISO(iso_addreq.ifra_dstaddr)};
int iso_getaddr(char *addr, int which)
void iso_getaddr(char *addr, int which)
{
register struct sockaddr_iso *siso = sisotab[which];
struct iso_addr *iso_addr();
......
......@@ -209,7 +209,6 @@ main(int argc, char *argv[])
int ch;
char *nlistf = NULL, *memf = NULL;
char buf[_POSIX2_LINE_MAX];
char buf2[_POSIX2_LINE_MAX];
if (cp = rindex(argv[0], '/'))
prog = cp + 1;
......
......@@ -166,4 +166,6 @@ int main(void)
sockets_init();
atexit(sockets_discard);
sockets_list_interfaces();
return 0;
}
......@@ -191,11 +191,6 @@ Neighbor *find_neighbor(addr, node)
#ifdef __STDC__
void
log(int severity, int syserr, char *format, ...)
{
va_list ap;
char fmt[100];
va_start(ap, format);
#else
/*VARARGS3*/
void
......@@ -203,13 +198,11 @@ log(severity, syserr, format, va_alist)
int severity, syserr;
char *format;
va_dcl
#endif
{
va_list ap;
char fmt[100];
va_start(ap);
#endif
switch (debug) {
case 0: if (severity > LOG_WARNING) return;
case 1: if (severity > LOG_NOTICE ) return;
......@@ -220,7 +213,13 @@ log(severity, syserr, format, va_alist)
strcpy(fmt, "warning - ");
strncat(fmt, format, sizeof(fmt)-strlen(fmt));
fmt[sizeof(fmt)-1]='\0';
#ifdef __STDC__
va_start(ap, format);
#else
va_start(ap);
#endif
vfprintf(stderr, fmt, ap);
va_end(ap);
if (syserr == 0)
fprintf(stderr, "\n");
#ifdef __riscos
......
......@@ -69,27 +69,35 @@ MDXFileChunk(const char *filename, char *buf, off_t ofs, off_t len)
handle = fopen(filename, "rb");
if (handle == NULL)
return NULL;
if (fseek(handle, 0, SEEK_END) != 0)
return NULL;
if (fseek(handle, 0, SEEK_END) != 0) {
i = -1;
goto error;
}
stbuf.st_size = ftell(handle);
#else
MDXInit(&ctx);
f = open(filename, O_RDONLY);
if (f < 0)
return 0;
if (fstat(f, &stbuf) < 0)
return 0;
if (fstat(f, &stbuf) < 0) {
i = -1;
goto error;
}
#endif
if (ofs > stbuf.st_size)
ofs = stbuf.st_size;
if ((len == 0) || (len > stbuf.st_size - ofs))
len = stbuf.st_size - ofs;
#ifdef RISCOS_TWEAK
if (fseek(handle, ofs, SEEK_SET) != 0)
return NULL;
if (fseek(handle, ofs, SEEK_SET) != 0) {
i = -1;
goto error;
}
#else
if (lseek(f, ofs, SEEK_SET) < 0)
return 0;
if (lseek(f, ofs, SEEK_SET) < 0) {
i = -1;
goto error;
}
#endif
n = len;
i = 0;
......@@ -111,6 +119,7 @@ MDXFileChunk(const char *filename, char *buf, off_t ofs, off_t len)
MDXUpdate(&ctx, buffer, i);
n -= i;
}
error:
e = errno;
#ifdef RISCOS_TWEAK
fclose(handle);
......
......@@ -137,23 +137,17 @@ inet_name(addr)
#ifdef __STDC__
void
log(int severity, int syserr, char *format, ...)
{
va_list ap;
char fmt[100];
va_start(ap, format);
#else
void
log(severity, syserr, format, va_alist)
int severity, syserr;
char *format;
va_dcl
#endif
{
va_list ap;
char fmt[100];
va_start(ap);
#endif
switch (debug) {
case 0:
if (severity > LOG_WARNING)
......@@ -170,7 +164,13 @@ log(severity, syserr, format, va_alist)
strcpy(fmt, "warning - ");
strncat(fmt, format, sizeof(fmt)-strlen(fmt));
fmt[sizeof(fmt)-1]='\0';
#ifdef __STDC__
va_start(ap, format);
#else
va_start(ap);
#endif
vfprintf(stderr, fmt, ap);
va_end(ap);
if (syserr == 0)
fprintf(stderr, "\n");
#ifdef __riscos
......
......@@ -3236,11 +3236,6 @@ check_vif_state()
#ifdef __STDC__
void
log(int severity, int syserr, char *format, ...)
{
va_list ap;
char fmt[100];
va_start(ap, format);
#else
/*VARARGS3*/
void
......@@ -3248,13 +3243,11 @@ log(severity, syserr, format, va_alist)
int severity, syserr;
char *format;
va_dcl
#endif
{
va_list ap;
char fmt[100];
va_start(ap);
#endif
switch (debug) {
case 0: if (severity > LOG_WARNING) return;
case 1: if (severity > LOG_NOTICE) return;
......@@ -3265,7 +3258,13 @@ log(severity, syserr, format, va_alist)
strcpy(fmt, "warning - ");
strncat(fmt, format, sizeof(fmt)-strlen(fmt));
fmt[sizeof(fmt)-1]='\0';
#ifdef __STDC__
va_start(ap, format);
#else
va_start(ap);
#endif
vfprintf(stderr, fmt, ap);
va_end(ap);
if (syserr == 0)
fprintf(stderr, "\n");
#ifdef __riscos
......
......@@ -96,6 +96,7 @@ int filer_task(void)
}
_kernel_raise_error((_kernel_oserror *) &nofiler_err);
/* NOTREACHED */
}
void startfilers(void)
......
......@@ -125,6 +125,7 @@ main(int argc, char *argv[])
/*
* List all variables known to the system.
*/
void
listall(char *path, struct list *lp)
{
int lvl2;
......@@ -142,6 +143,7 @@ listall(char *path, struct list *lp)
* Parse a name into an index.
* Lookup and print out the attribute if it exists.
*/
void
parse(char *pathname, char *string, int flags)
{
int indx, value;
......@@ -187,6 +189,7 @@ parse(char *pathname, char *string, int flags)
/*
* Scan a list of names searching for a particular name.
*/
int
findname(char *string, char *level, char **bufp, struct list *namelist)
{
char *name;
......
......@@ -201,11 +201,9 @@ parse(char *string)
newval = &intval;
newsize = sizeof intval;
break;
break;
case CTLTYPE_STRING:
break;
case CTLTYPE_QUAD:
break;
#ifdef __riscos
sscanf(newval, "%ld", &quadval);
#else
......
/* (5.60)
/* (5.61)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 5.60
#define Module_MajorVersion_CMHG 5.61
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 17 Mar 2018
#define Module_Date_CMHG 23 Mar 2018
#define Module_MajorVersion "5.60"
#define Module_Version 560
#define Module_MajorVersion "5.61"
#define Module_Version 561
#define Module_MinorVersion ""
#define Module_Date "17 Mar 2018"
#define Module_Date "23 Mar 2018"
#define Module_ApplicationDate "17-Mar-18"
#define Module_ApplicationDate "23-Mar-18"
#define Module_ComponentName "Internet"
#define Module_ComponentPath "mixed/RiscOS/Sources/SystemRes/Internet"
#define Module_FullVersion "5.60"
#define Module_HelpVersion "5.60 (17 Mar 2018)"
#define Module_LibraryVersionInfo "5:60"
#define Module_FullVersion "5.61"
#define Module_HelpVersion "5.61 (23 Mar 2018)"
#define Module_LibraryVersionInfo "5:61"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment