1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-14 03:10:47 +00:00
freebsd-ports/math/physcalc/files/patch-ab
Pav Lucistnik 73aa4fd5f4 - The path to the .phy files was built up using un-zero'd memory, so it could
(and did, for me) break in strange and unexpected ways.

- EOF on input (e.g., ^D) would cause it to loop forever.

PR:		ports/136060
Submitted by:	Matthew D. Fuller <fullermd@over-yonder.net>
2009-06-26 11:25:37 +00:00

30 lines
774 B
Plaintext

--- physconv.c.orig 1998-08-30 15:58:16.000000000 -0500
+++ physconv.c 2009-06-25 22:22:21.000000000 -0500
@@ -260,12 +260,16 @@
{ /* read in lines from fp and do each as if typed from console */
FILE *fp;
char buf[SMALLBUF];
+ char *fullpath;
int oldecho;
#ifdef TRACE
int oldtrace;
#endif
- if ((fp = fopen(s,"r"))==NULL) {
+ fullpath = calloc( strlen( SHAREDIR ) + strlen( s ) + 1, 1 );
+ bcopy(SHAREDIR, fullpath, strlen(SHAREDIR));
+ (void) strcat(fullpath, s);
+ if ((fp = fopen(fullpath,"r"))==NULL) {
printf("Can't open %s\n",s);
return;
}
@@ -797,7 +801,7 @@
} else {
showdims(&d);
printf("Convert to: ");
- gets(buf);
+ fgets(buf, sizeof(buf), stdin);
trimspc(buf);
if (buf[0]=='?') {
showdims(&d);