Module Name: src
Committed By: gutteridge
Date: Thu Oct 31 01:21:12 UTC 2024
Modified Files:
src/sys/arch/hppa/stand/mkboot: mkboot.c
Log Message:
mkboot.c: ensure all functions are declared
Addresses build failure issue on current Linux distros that have a GCC
with implicit-function-declaration baked in as an error. Use be32toh(3)
instead of ntohl(3), seems to make more sense stylistically. Build
tested on Fedora 40.
Issue reported by Jan-Benedict Glaw. Also relevant to PR lib/58674.
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/hppa/stand/mkboot/mkboot.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/hppa/stand/mkboot/mkboot.c
diff -u src/sys/arch/hppa/stand/mkboot/mkboot.c:1.4 src/sys/arch/hppa/stand/mkboot/mkboot.c:1.5
--- src/sys/arch/hppa/stand/mkboot/mkboot.c:1.4 Wed Mar 20 00:34:32 2024
+++ src/sys/arch/hppa/stand/mkboot/mkboot.c Thu Oct 31 01:21:12 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: mkboot.c,v 1.4 2024/03/20 00:34:32 christos Exp $ */
+/* $NetBSD: mkboot.c,v 1.5 2024/10/31 01:21:12 gutteridge Exp $ */
/* $OpenBSD: mkboot.c,v 1.9 2001/05/17 00:57:55 pvalchev Exp $ */
@@ -53,6 +53,7 @@ static char rcsid[] = "$OpenBSD: mkboot.
#endif
#include <sys/param.h>
+#include <sys/endian.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <string.h>
@@ -83,7 +84,7 @@ static char rcsid[] = "$OpenBSD: mkboot.
* Header prepended to each a.out file.
*/
struct exec {
- u_long a_midmag; /* htonl(flags<<26 | mid<<16 | magic) */
+ u_long a_midmag; /* htobe32(flags<<26 | mid<<16 | magic) */
u_long a_text; /* text segment size */
u_long a_data; /* initialized data size */
u_long a_bss; /* uninitialized data size */
@@ -101,7 +102,7 @@ struct exec {
#define N_GETMAGIC(ex) \
((((ex).a_midmag)&0xffff0000) ? \
- (ntohl((uint32_t)((ex).a_midmag))&0xffff) : ((ex).a_midmag))
+ (be32toh((uint32_t)((ex).a_midmag))&0xffff) : ((ex).a_midmag))
#include <stdio.h>
#include <ctype.h>