git: c7746e3ede88 - main - sysutils/procmap: Fix compilation warnings

From: Rodrigo Osorio <rodrigo_at_FreeBSD.org>
Date: Sun, 21 Jan 2024 16:18:54 UTC
The branch main has been updated by rodrigo:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c7746e3ede88d4db4177b097606dfcdbf4d75830

commit c7746e3ede88d4db4177b097606dfcdbf4d75830
Author:     Ricardo Branco <rbranco@suse.de>
AuthorDate: 2024-01-04 21:50:47 +0000
Commit:     Rodrigo Osorio <rodrigo@FreeBSD.org>
CommitDate: 2024-01-21 16:16:27 +0000

    sysutils/procmap: Fix compilation warnings
    
    Reorder and reformat Makefile to make linters happy
---
 sysutils/procmap/Makefile        | 15 ++++++++++-----
 sysutils/procmap/files/procmap.c |  4 +++-
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/sysutils/procmap/Makefile b/sysutils/procmap/Makefile
index a23ceb3fb7aa..21030d39d1fa 100644
--- a/sysutils/procmap/Makefile
+++ b/sysutils/procmap/Makefile
@@ -1,20 +1,25 @@
 PORTNAME=	procmap
 PORTVERSION=	1.0
+PORTREVISION=	1
 CATEGORIES=	sysutils
 DISTFILES=	#empty
 
 MAINTAINER=	ports@FreeBSD.org
 COMMENT=	Print the contents of a procfs map file
 
-NO_WRKSUBDIR=	yes
 USES=		uidfix
 MAKEFILE=	/usr/share/mk/bsd.prog.mk
-MAKE_ENV+=	BINDIR=${PREFIX}/bin MANDIR=${PREFIX}/man/man \
-		PROG=procmap MAN8=procmap.8
+MAKE_ENV+=	BINDIR=${PREFIX}/bin \
+		MAN8=procmap.8 \
+		MANDIR=${PREFIX}/man/man \
+		PROG=procmap
+
+NO_WRKSUBDIR=	yes
 
-PLIST_FILES=	bin/procmap man/man8/${PORTNAME}.8.gz
+PLIST_FILES=	bin/procmap \
+		man/man8/${PORTNAME}.8.gz
 
-procmap_files := procmap.c procmap.8
+procmap_files:=	procmap.c procmap.8
 
 post-extract:
 	cd ${FILESDIR} ; \
diff --git a/sysutils/procmap/files/procmap.c b/sysutils/procmap/files/procmap.c
index 641e70eb3628..57f5d2a50cfb 100644
--- a/sysutils/procmap/files/procmap.c
+++ b/sysutils/procmap/files/procmap.c
@@ -35,8 +35,10 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <unistd.h>
 
 /* The longest possible path is "/proc/curproc/map". */
 #define MAXPATH 18
@@ -86,7 +88,7 @@ main(int argc, char **argv)
 			exit(1);
 		}
 		/* Leave space for a NULL terminator at the end of buf. */
-		if (bytes = read(mfd, buf, size - 1) < 0) {
+		if ((bytes = read(mfd, buf, size - 1)) < 0) {
 			if (errno == EFBIG) {
 				/* Buffer to small; try again. */
 				size <<= 1;