git: 39191036a1f8 - main - astro/accrete: Fix RUNTIME

From: Muhammad Moinur Rahman <bofh_at_FreeBSD.org>
Date: Sat, 31 Dec 2022 21:59:30 UTC
The branch main has been updated by bofh:

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

commit 39191036a1f8c22f0d1424afa90f2f2559f124ad
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2022-12-31 19:49:42 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2022-12-31 21:58:55 +0000

    astro/accrete: Fix RUNTIME
    
    Segmentation Fault occurs if program is executed in a directory without
    write privileges.
    
    Patch provided exits gracefully if *fp is NULL before fprintf's attempt
    to write to non-existent file.
    
    - Add LICENSE BSD3CLAUSE
    
    PR:             268661
    Reported by:    eylusion@gmail.com
---
 astro/accrete/Makefile              |  3 +++
 astro/accrete/files/patch-display.c | 14 ++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/astro/accrete/Makefile b/astro/accrete/Makefile
index daa279fd5a34..ef45ff7024cc 100644
--- a/astro/accrete/Makefile
+++ b/astro/accrete/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	accrete
 PORTVERSION=	1.0
+PORTREVISION=	1
 CATEGORIES=	astro
 MASTER_SITES=	SF
 
@@ -7,6 +8,8 @@ MAINTAINER=	ports@FreeBSD.org
 COMMENT=	Physical simulation of solar system planet formation
 WWW=		https://sourceforge.net/projects/accrete/
 
+LICENSE=	BSD3CLAUSE
+
 MAKE_ARGS=	CC="${CC}" CFLAGS="${CFLAGS}" PREFIX=${STAGEDIR}${PREFIX} \
 		CDEBUG="" COPT=""
 PLIST_FILES=	bin/accrete
diff --git a/astro/accrete/files/patch-display.c b/astro/accrete/files/patch-display.c
new file mode 100644
index 000000000000..73a2e4174462
--- /dev/null
+++ b/astro/accrete/files/patch-display.c
@@ -0,0 +1,14 @@
+--- display.c.orig	2022-12-31 01:22:36 UTC
++++ display.c
+@@ -8,6 +8,11 @@ display_system (void)
+ 
+      FILE *f;
+      f = fopen("New.System", "w");
++	 if (f == NULL)
++	 {
++	   perror("New.System");
++	   exit(1);
++	 }
+ 
+      fprintf(f,"                         SYSTEM  CHARACTERISTICS\n");
+      fprintf(f,"Mass of central star:          %6.3f solar masses\n", stellar_mass_ratio);