Bug 38001 - [PATCH] games/editss segfaults if ~/.xpilotrc is not present
Summary: [PATCH] games/editss segfaults if ~/.xpilotrc is not present
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-05-12 21:30 UTC by Pierre-Paul Lavoie
Modified: 2002-10-10 07:41 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre-Paul Lavoie 2002-05-12 21:30:01 UTC
      Fix some warning about value.h. Make sure that it doesn't attempt to fclose a NULL pointer if ~/.xpilotrc is not present.

Fix: 

http://bloodaxis.dyndns.org/~ppl/patch/editss.diff
How-To-Repeat:       run editss without a ~/.xpilotrc
Comment 1 Pierre-Paul Lavoie 2002-07-06 04:07:41 UTC
Making sure the small patch doesn't become unavailable on the web...


diff -ruN editss-2.2-old/actions.c editss-2.2/actions.c
--- editss-2.2-old/actions.c	Sun May 12 16:50:47 2002
+++ editss-2.2/actions.c	Sun May 12 16:54:08 2002
@@ -32,7 +32,7 @@
 
 #include <stdio.h>					/* usual include stuff */
 #include <stdlib.h>
-#include <values.h>
+#include <limits.h>
 #include <string.h>
 #include <fcntl.h>
 #include <time.h>
diff -ruN editss-2.2-old/editss.c editss-2.2/editss.c
--- editss-2.2-old/editss.c	Sun May 12 16:50:47 2002
+++ editss-2.2/editss.c	Sat Jul  6 00:01:17 2002
@@ -28,7 +28,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <values.h>
+#include <limits.h>
 #include <string.h>
 #include <fcntl.h>
 #include <time.h>
@@ -509,7 +509,7 @@
 	while (getoneshipdef(a,fin)) {
 		nrships+=1;	
 	}		   
-	fclose(fin);
+	if (fin!=NULL) fclose(fin);
 	if (nrships<1) i1=1; else i1=nrships;
 
 	a[0]='\0';
diff -ruN editss-2.2-old/xstuff.c editss-2.2/xstuff.c
--- editss-2.2-old/xstuff.c	Sun May 12 16:50:47 2002
+++ editss-2.2/xstuff.c	Sun May 12 16:53:53 2002
@@ -28,7 +28,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <values.h>
+#include <limits.h>
 #include <string.h>
 #include <fcntl.h>
 #include <time.h>
Comment 2 Ying-Chieh Liao freebsd_committer freebsd_triage 2002-10-10 07:41:09 UTC
State Changed
From-To: open->closed

committed, thanks