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
This commit is contained in:
Muhammad Moinur Rahman 2022-12-31 13:49:42 -06:00
parent 996fc7183e
commit 39191036a1
2 changed files with 17 additions and 0 deletions

View File

@ -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

View File

@ -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);