Commit Diff


commit - fd740a5299ccd8f3dea9fa2233c96817b5445791
commit + 3afd24a5db541817c3ec9c2cc8eda0ab4c72ede1
blob - 319171e451d93996155bfe2d7ebdcce6045f7edf
blob + 076e16e33dcc1f435ab6724393938622b04715db
--- FICS/makerank.c
+++ FICS/makerank.c
@@ -13,6 +13,7 @@
 #endif
 
 #include "common.h"
+#include "ficsmain.h"
 #include "makerank.h"
 #include "utils.h"
 
@@ -274,6 +275,7 @@ makerank(void)
 {
 	FILE	*fp;
 	char	 fName[200];
+	int	 fd;
 	int	 sortnum, sortmesize, i, n;
 
 	printf("Loading players\n");
@@ -313,8 +315,9 @@ makerank(void)
 		snprintf(fName, sizeof fName, "%s/rank.%s", DEFAULT_STATS,
 		    rnames[rtype]);
 
-		if ((fp = fopen(fName, "w")) == NULL)
-			err(1, "%s: fopen", __func__);
+		if ((fd = open(fName, g_open_flags[1], g_open_modes)) < 0 ||
+		    (fp = fdopen(fd, "w")) == NULL)
+			err(1, "%s: rank file open error", __func__);
 
 		for (i = 0; i < sortnum; i++) {
 			fprintf(fp, "%s %d %d %d\n",